/** * Trigger a custom event. * * This only works for enterprise accounts. * * @param string $hubId Your HubSpot portal ID ("Hub ID"). You can find your Hub ID in the * footer of the HubSpot UI, or in the URL. For example, in this URL: * "https://app.hubspot.com/reports/56043/events/" your Hub ID is "56043". * @param string $eventId * @param string $contactEmail Optional - contact email. * @param float $contactRevenue Optional - the monetary value this event means to you. * @param array $contactProperties Optional - array of new contact properties. * @return \SevenShores\Hubspot\Http\Response */ function trigger($hubId, $eventId, $contactEmail = null, $contactRevenue = null, $contactProperties = []) { $endpoint = sprintf("http://track.hubspot.com/v1/event?_a=%s&_n=%s", url_encode($hubId), url_encode($eventId)); $contactProperties['email'] = $contactEmail; $contactProperties['_m'] = $contactRevenue; $query_string = build_query_string($contactProperties); return $this->client->request('get', $endpoint, [], $query_string); }
function url_encode($str) { if (is_array($str)) { foreach ($str as $key => $value) { $str[urlencode($key)] = url_encode($value); } } else { $str = urlencode($str); } return $str; }
public function getImpTracksTagAttribute() { $tag = ''; $impTracks = json_decode($this->video_impression_track, 1); if (!empty($impTracks)) { foreach ($impTracks as $link) { $tag .= '<Impression><![CDATA[' . url_encode($link) . ']]></Impression>'; } } $tag .= '<Impression><![CDATA[' . urlTracking('impression', $this->id, $this->flight_publisher_id, $this->publisher_ad_zone_id, $this->checksum, $this->ovr) . ']]></Impression>'; return $tag; }
function index() { $seg =& $this->seg; $wr_id = $seg->get('wr_id'); $no = $seg->get('no'); // 쿠키에 저장된 ID값과 넘어온 ID값을 비교하여 같지 않을 경우 오류 발생 // 다른곳에서 링크 거는것을 방지하기 위한 코드 if (!$this->session->userdata('ss_view_' . BO_TABLE . '_' . $wr_id)) { alert('잘못된 접근입니다.'); } $CI =& get_instance(); $CI->load->model('Board_file_model'); $file = $CI->Board_file_model->get_file(BO_TABLE, $wr_id, $no); if (!isset($file['bf_file'])) { alert_close('파일 정보가 존재하지 않습니다.'); } $board =& $this->board; $member =& $this->member; if ($member['mb_level'] < $board['bo_download_level']) { $alert_msg = '다운로드 권한이 없습니다.'; if (IS_MEMBER) { alert($alert_msg); } else { alert($alert_msg . "\\n\\n회원이라면 로그인 후 이용하세요.", 'member/login/qry/' . url_encode('board/' . BO_TABLE . '/view/wr_id/' . $wr_id)); } } // 다운수 증가 $ss_name = 'ss_down_' . BO_TABLE . '_' . $wr_id . '_' . $no; if (!$this->session->userdata($ss_name)) { // 다운로드 카운트 증가 $CI->Board_file_model->file_down_update(BO_TABLE, $wr_id, $no); $this->session->set_userdata($ss_name, TRUE); } $filepath = addslashes(DATA_PATH . '/file/' . BO_TABLE . '/' . $file['bf_file']); if (file_exists($filepath)) { if (preg_match("/^utf/i", $this->config->item('charset'))) { $original = urlencode($file['bf_source']); } else { $original = $file['bf_source']; } $this->load->helper('download'); if (!force_download($original, file_get_contents($filepath))) { alert('파일을 찾을 수 없습니다.'); } } else { alert('파일을 찾을 수 없습니다.'); } }
function http_post_request($host, $path, $data, $port = 80) { $req = url_encode($data); $http_request = "POST {$path} HTTP/1.0\r\n"; $http_request .= "Host: {$host}\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; $http_request .= "Content-Length: " . strlen($req) . "\r\n"; $http_request .= "User-Agent: yocaptcha/PHP\r\n"; $http_request .= "\r\n"; $http_request .= $req; $response = ''; if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) { die('Could not open socket'); } fwrite($fs, $http_request); while (!feof($fs)) { $response .= fgets($fs, 1160); } // One TCP-IP packet fclose($fs); return $response; }
function listdir($directory) { global $dirlink, $basedir; $handle = opendir($basedir . $directory); while ($file = readdir($handle)) { $filelist[] = $file; } $count = 1; natcasesort($filelist); while (list($key, $file) = each($filelist)) { if ($GLOBALS['CONFIG']['PROCESS_INDEX'] && in_array($file, $GLOBALS['CONFIG']['INDEX_FILES'])) { header('Location: ' . substr($directory, 1) . '/' . $file); } if (($GLOBALS['CONFIG']['DISPLAY_HIDDEN'] || !$GLOBALS['CONFIG']['DISPLAY_HIDDEN'] && $file[0] != ".") && $file != '.' && $file != '..' && (!is_array($GLOBALS['CONFIG']['HIDE_FILES']) || is_array($GLOBALS['CONFIG']['HIDE_FILES']) && !in_array($basedir . $directory . '/' . $file, $GLOBALS['CONFIG']['HIDE_FILES']))) { $stats = stat($basedir . $directory . '/' . $file); if ($basedir . $directory . '/' == './') { $dirlink = ''; } else { $dirlink = $basedir . $directory . '/'; } if (is_dir($basedir . $directory . '/' . $file)) { $dirc[] = '<td width="100%"><table cellpadding="0" cellspacing="0" width="100%"><tr><td width="18">' . '<img src="' . $_SERVER['SCRIPT_NAME'] . '?p=mime&type=' . getmime($directory . '/' . $file) . '" border="0" alt=""><td align="left"><a href="' . $_SERVER['SCRIPT_NAME'] . '?dir=' . $dirlink . $file . '">' . $file . '</a></table>' . '<td nowrap>' . date('F jS Y', $stats['9']) . '<td nowrap> - '; } elseif (iswebtype($file)) { $filec[] = '<td width="100%"><table cellpadding="0" cellspacing="0" width="100%"><tr><td width="18"><a href="' . $dirlink . url_encode($file) . '"><img src="' . $_SERVER['SCRIPT_NAME'] . '?p=mime&type=' . getmime($directory . '/' . $file) . '" border="0" alt=""></a></td>' . '<td align="left"><a href="' . $_SERVER['SCRIPT_NAME'] . '?p=source&file=' . url_encode($dirlink . $file) . '">' . $file . '</a></table>' . '<td nowrap>' . date('F jS Y', $stats['9']) . '<td nowrap>' . getsize($stats['7']); } elseif (isimgtype($file)) { $filec[] = '<td width="100%"><table cellpadding="0" cellspacing="0" width="100%"><tr><td width="18"><a href="' . $dirlink . url_encode($file) . '"><img src="' . $_SERVER['SCRIPT_NAME'] . '?p=thumb&file=' . base64_encode($directory . '/' . $file) . '" border="0" alt=""></a></td>' . '<td align="left"><a href="' . $dirlink . url_encode($file) . '">' . $file . '</a></table>' . '<td nowrap>' . date('F jS Y', $stats['9']) . '<td nowrap>' . getsize($stats['7']); } else { $filec[] = '<td width="100%"><table cellpadding="0" cellspacing="0" width="100%"><tr><td width="18"><a href="' . $dirlink . url_encode($file) . '"><img src="' . $_SERVER['SCRIPT_NAME'] . '?p=mime&type=' . getmime($directory . '/' . $file) . '" border="0" alt=""></a></td>' . '<td align="left"><a href="' . $dirlink . url_encode($file) . '">' . $file . '</a></table>' . '<td nowrap>' . date('F jS Y', $stats['9']) . '<td nowrap>' . getsize($stats['7']); } } } pagehead($directory); $dirdis = '.' . $directory . '/'; echo '<tr><td colspan="3" nowrap><b>Current Directory: '; while ($basepos = strpos($dirdis, '/')) { if ($dirlist[$t - 1] == '') { $dirlist[$t] = substr($dirdis, 0, $basepos); } else { $dirlist[$t] = $dirlist[$t - 1] . '/' . substr($dirdis, 0, $basepos); } echo '/<a href="' . $_SERVER['SCRIPT_NAME'] . '?dir=' . $dirlist[$t] . '">' . substr($dirdis, 0, $basepos) . '</a>'; $dirdis = substr($dirdis, $basepos + 1, strlen($dirdis)); $t++; } echo '</b><tr class="head"><td width="100%" bgcolor="' . $GLOBALS['CONFIG']['TB_COLOR_4'] . '">Name<td nowrap bgcolor="' . $GLOBALS['CONFIG']['TB_COLOR_4'] . '">Last Modified<td nowrap bgcolor="' . $GLOBALS['CONFIG']['TB_COLOR_4'] . '">Size'; if ($dirc) { asort($dirc); foreach ($dirc as $dir) { $tcoloring = $a % 2 ? $GLOBALS['CONFIG']['TB_COLOR_2'] : $GLOBALS['CONFIG']['TB_COLOR_3']; echo '<tr bgcolor="' . $tcoloring . '">' . $dir; $a++; } } if ($filec) { asort($filec); foreach ($filec as $file) { $tcoloring = $a % 2 ? $GLOBALS['CONFIG']['TB_COLOR_2'] : $GLOBALS['CONFIG']['TB_COLOR_3']; echo '<tr bgcolor="' . $tcoloring . '">' . $file; $a++; } } $dir = $directory; if (!$dir) { $dir = './'; } else { $dir = '.' . $directory; } $count = countdir($dir); echo '<tr bgcolor="' . $GLOBALS['CONFIG']['TB_COLOR_4'] . '"><td><b>' . number_format($count[1]) . '</b> lines of code in <b>' . number_format($count[2]) . '</b> files within <b>' . number_format($count[3]) . '</b> directories.' . '<td> <td nowrap><b>' . getsize($count[0]) . '</b>'; pagefoot(); }
/** * Generate a query string for batch requests. * * @param string $key The name of the query variable. * @param array $items An array of item values for the variable. * @param int $encoding * @return string */ function build_batch_query_string($key, $items, $encoding = PHP_QUERY_RFC3986) { return array_reduce($items, function ($query, $item) use($key, $encoding) { return $query . "&" . url_encode($key, $encoding) . '=' . url_encode($item, $encoding); }, ''); }
/** * do cancelClick: redirect to lister * JRequest: -- */ public function cancel() { // pop lister status from listStatusStack $session = JFactory::getSession(); $listStatusStack = JSON_decode($session->get('listStatusStack', '[]')); $listStatus = $listStatusStack[count($listStatusStack) - 1]; unset($listStatusStack[count($listStatusStack) - 1]); $link = JURI::base() . 'index.php?option=' . JRequest::getVar('option') . '&task=' . $this->viewName . '.list' . '&limitstart=' . $listStatus->limitstart . '&limit=' . $listStatus->limit . '&ordering=' . $listStatus->ordering . '&parent=' . $listStatus->parent . '&filterStr=' . url_encode($listStatus->filterStr) . '&Itemid=' . $listStatus->Itemid; $this->setRedirect($link); }
/** @test */ public function encode_false() { $string = "I wan't this encoded!"; $queryString = url_encode($string, false); $this->assertEquals($string, $queryString); }
/** * Updates a plugin (call its upgrade function). * * @param pi_name string name of the plugin to uninstall * @return string HTML for error or success message * */ function PLUGINS_update($pi_name) { global $_CONF, $LANG32, $LANG08, $MESSAGE, $_IMAGE_TYPE; $retval = ''; if (strlen($pi_name) == 0) { $retval .= COM_showMessageText($LANG32[12], $LANG32[13], true); COM_errorLog($LANG32[12]); return $retval; } $result = PLG_upgrade($pi_name); if ($result > 0) { if ($result === TRUE) { // Catch returns that are just true/false COM_setMessage(60); $retval .= COM_refresh($_CONF['site_admin_url'] . '/plugins.php'); } else { // Plugin returned a message number COM_setMessage($result); $retval = COM_refresh($_CONF['site_admin_url'] . '/plugins.php?plugin=' . url_encode($pi_name)); } } else { // Plugin function returned a false $retval .= COM_showMessage(95); } CTL_clearCache(); return $retval; }
/** * Process submit on an account */ protected function processSubmitAccount() { Hook::exec('actionBeforeSubmitAccount'); $this->create_account = true; if (Tools::isSubmit('submitAccount')) { $this->context->smarty->assign('email_create', 1); } // New Guest customer if (!Tools::getValue('is_new_customer', 1) && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) { $this->errors[] = Tools::displayError('You cannot create a guest account..'); } if (!Tools::getValue('is_new_customer', 1)) { $_POST['passwd'] = md5(time() . _COOKIE_KEY_); } if (isset($_POST['guest_email']) && $_POST['guest_email']) { $_POST['email'] = $_POST['guest_email']; } // Checked the user address in case he changed his email address if (Validate::isEmail($email = Tools::getValue('email')) && !empty($email)) { if (Customer::customerExists($email)) { $this->errors[] = Tools::displayError('An account using this email address has already been registered.', false); } } // Preparing customer $customer = new Customer(); $lastnameAddress = $_POST['lastname']; $firstnameAddress = $_POST['firstname']; $_POST['lastname'] = Tools::getValue('customer_lastname'); $_POST['firstname'] = Tools::getValue('customer_firstname'); $error_phone = false; if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) { if (Tools::isSubmit('submitGuestAccount') || !Tools::getValue('is_new_customer')) { if (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')) { $error_phone = true; } } elseif ((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || Configuration::get('PS_ORDER_PROCESS_TYPE')) && (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create')) && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) { $error_phone = true; } elseif (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE') && Tools::getValue('email_create') && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) { $error_phone = true; } } if ($error_phone) { $this->errors[] = Tools::displayError('You must register at least one phone number.'); } $this->errors = array_unique(array_merge($this->errors, $customer->validateController())); // Check the requires fields which are settings in the BO $this->errors = array_merge($this->errors, $customer->validateFieldsRequiredDatabase()); if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) { if (!count($this->errors)) { if (Tools::isSubmit('newsletter')) { $this->processCustomerNewsletter($customer); } $customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days']; if (!Validate::isBirthDate($customer->birthday)) { $this->errors[] = Tools::displayError('Invalid date of birth.'); } // New Guest customer $customer->is_guest = Tools::isSubmit('is_new_customer') ? !Tools::getValue('is_new_customer', 1) : 0; $customer->active = 1; if (!count($this->errors)) { if ($customer->add()) { if (!$customer->is_guest) { if (!$this->sendConfirmationMail($customer)) { $this->errors[] = Tools::displayError('The email cannot be sent.'); } } $this->updateContext($customer); $this->context->cart->update(); Hook::exec('actionCustomerAccountAdd', array('_POST' => $_POST, 'newCustomer' => $customer)); if ($this->ajax) { $return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => true, 'id_customer' => (int) $this->context->cookie->id_customer, 'id_address_delivery' => $this->context->cart->id_address_delivery, 'id_address_invoice' => $this->context->cart->id_address_invoice, 'token' => Tools::getToken(false)); die(Tools::jsonEncode($return)); } if ($back = Tools::getValue('back')) { Tools::redirect(html_entity_decode($back)); } // redirection: if cart is not empty : redirection to the cart if (count($this->context->cart->getProducts(true)) > 0) { Tools::redirect('index.php?controller=order&multi-shipping=' . (int) Tools::getValue('multi-shipping')); } else { Tools::redirect('index.php?controller=' . ($this->authRedirection !== false ? url_encode($this->authRedirection) : 'my-account')); } } else { $this->errors[] = Tools::displayError('An error occurred while creating your account..'); } } } } else { // Preparing address $address = new Address(); $_POST['lastname'] = $lastnameAddress; $_POST['firstname'] = $firstnameAddress; $address->id_customer = 1; $this->errors = array_unique(array_merge($this->errors, $address->validateController())); // US customer: normalize the address if ($address->id_country == Country::getByIso('US')) { include_once _PS_TAASC_PATH_ . 'AddressStandardizationSolution.php'; $normalize = new AddressStandardizationSolution(); $address->address1 = $normalize->AddressLineStandardization($address->address1); $address->address2 = $normalize->AddressLineStandardization($address->address2); } if (!($country = new Country($address->id_country)) || !Validate::isLoadedObject($country)) { $this->errors[] = Tools::displayError('Country cannot be loaded with address->id_country'); } $postcode = Tools::getValue('postcode'); /* Check zip code format */ if ($country->zip_code_format && !$country->checkZipCode($postcode)) { $this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)))); } elseif (empty($postcode) && $country->need_zip_code) { $this->errors[] = Tools::displayError('A Zip / Postal code is required.'); } elseif ($postcode && !Validate::isPostCode($postcode)) { $this->errors[] = Tools::displayError('The Zip / Postal code is invalid.'); } if ($country->need_identification_number && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni')))) { $this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.'); } elseif (!$country->need_identification_number) { $address->dni = null; } } if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) { $this->errors[] = Tools::displayError('Invalid date of birth'); } if (!count($this->errors)) { if (Customer::customerExists(Tools::getValue('email'))) { $this->errors[] = Tools::displayError('An account using this email address has already been registered. Please enter a valid password or request a new one. ', false); } if (Tools::isSubmit('newsletter')) { $this->processCustomerNewsletter($customer); } $customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days']; if (!Validate::isBirthDate($customer->birthday)) { $this->errors[] = Tools::displayError('Invalid date of birth'); } if (!count($this->errors)) { // if registration type is in one step, we save the address if (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || Tools::isSubmit('submitGuestAccount')) { if (!($country = new Country($address->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country)) { die(Tools::displayError()); } } $contains_state = isset($country) && is_object($country) ? (int) $country->contains_states : 0; $id_state = isset($address) && is_object($address) ? (int) $address->id_state : 0; if (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && $contains_state && !$id_state) { $this->errors[] = Tools::displayError('This country requires you to chose a State.'); } else { $customer->active = 1; // New Guest customer if (Tools::isSubmit('is_new_customer')) { $customer->is_guest = !Tools::getValue('is_new_customer', 1); } else { $customer->is_guest = 0; } if (!$customer->add()) { $this->errors[] = Tools::displayError('An error occurred while creating your account..'); } else { $address->id_customer = (int) $customer->id; $this->errors = array_unique(array_merge($this->errors, $address->validateController())); if (!count($this->errors) && (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || $this->ajax || Tools::isSubmit('submitGuestAccount')) && !$address->add()) { $this->errors[] = Tools::displayError('An error occurred while creating your address.'); } else { if (!$customer->is_guest) { $this->context->customer = $customer; $customer->cleanGroups(); // we add the guest customer in the default customer group $customer->addGroups(array((int) Configuration::get('PS_CUSTOMER_GROUP'))); if (!$this->sendConfirmationMail($customer)) { $this->errors[] = Tools::displayError('The email cannot be sent.'); } } else { $customer->cleanGroups(); // we add the guest customer in the guest customer group $customer->addGroups(array((int) Configuration::get('PS_GUEST_GROUP'))); } $this->updateContext($customer); $this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int) $customer->id); $this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int) $customer->id); // If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated $this->context->cart->update(); // Avoid articles without delivery address on the cart $this->context->cart->autosetProductAddress(); Hook::exec('actionCustomerAccountAdd', array('_POST' => $_POST, 'newCustomer' => $customer)); if ($this->ajax) { $return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => true, 'id_customer' => (int) $this->context->cookie->id_customer, 'id_address_delivery' => $this->context->cart->id_address_delivery, 'id_address_invoice' => $this->context->cart->id_address_invoice, 'token' => Tools::getToken(false)); die(Tools::jsonEncode($return)); } // if registration type is in two steps, we redirect to register address if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) { Tools::redirect('index.php?controller=address'); } if ($back = Tools::getValue('back')) { Tools::redirect(html_entity_decode($back)); } // redirection: if cart is not empty : redirection to the cart if (count($this->context->cart->getProducts(true)) > 0) { Tools::redirect('index.php?controller=order&multi-shipping=' . (int) Tools::getValue('multi-shipping')); } else { Tools::redirect('index.php?controller=' . ($this->authRedirection !== false ? url_encode($this->authRedirection) : 'my-account')); } } } } } } if (count($this->errors)) { //for retro compatibility to display guest account creation form on authentication page if (Tools::getValue('submitGuestAccount')) { $_GET['display_guest_checkout'] = 1; } if (!Tools::getValue('is_new_customer')) { unset($_POST['passwd']); } if ($this->ajax) { $return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => false, 'id_customer' => 0); die(Tools::jsonEncode($return)); } $this->context->smarty->assign('account_error', $this->errors); } }
/** * encode_json 中文编码JSON * @param $data 数组 * @return string */ public static function encode_json($data) { if (version_compare('5.4', PHP_VERSION, '<')) { //5.4以上 return json_encode($data, JSON_UNESCAPED_UNICODE); } else { return urldecode(json_encode(url_encode($data))); } }
function cronjobs($flood_limit = 5) { require_once dirname(dirname(__FILE__)) . '/libraries/facebook/facebook.php'; $qcron = $this->db->query("SELECT lasttime FROM cron LIMIT 1"); $lasttime = $qcron->num_rows() > 0 ? $qcron->row()->lasttime : 0; $time = time(); if ($time - $lasttime < 1 * 60) { die("CRON - IN PROGRESS"); } $this->db->query("UPDATE cron SET lasttime='" . $time . "'"); $qusers = $this->db->query("SELECT id, gmt_zone FROM users WHERE status='1'"); if ($qusers->num_rows() > 0) { foreach ($qusers->result() as $user) { # - initialization $this->faceboook->settings($user->id); $this->config->set_item('facebook_app_id', $this->faceboook->app_id); $this->config->set_item('facebook_app_secret', $this->faceboook->app_secret); $this->config->set_item('facebook_app_version', $this->faceboook->app_version); $this->config->set_item('facebook_call', 1); $this->facebook = new Facebook(); $retry_limit = $this->faceboook->retry_limit; $track_clicks = $this->faceboook->track_clicks; $ap_enabled = $this->faceboook->ap_enabled; $ap_posts_limit = $this->faceboook->ap_posts_limit; $ap_posts_time = $this->faceboook->ap_posts_time; $timestamp = $this->timestamp($user->gmt_zone); $qposts = $this->db->query("SELECT posts.id, posts.access_token, posts.type as ptype, posts.message, posts.link, posts.picture, posts.picture_fbid, posts.name, posts.caption, posts.description, posts.cntposts FROM posts WHERE posts.id_users=" . $user->id . " AND posts.timestamp_pause='' AND posts.status='1' ORDER BY posts.timestamp ASC"); if ($qposts->num_rows() > 0) { foreach ($qposts->result() as $post) { $flood_limit = rand(3, 10); $qjobs = $this->db->query("SELECT cronjobs.id_wall, cronjobs.page_access_token, cronjobs.id as id_cron, cronjobs.type FROM cronjobs WHERE cronjobs.id_post='" . $post->id . "' AND (cronjobs.status='0' OR cronjobs.status='2') AND cronjobs.retry<'" . $retry_limit . "' AND cronjobs.timestamp<" . $timestamp . " ORDER BY cronjobs.id ASC LIMIT " . $flood_limit); if ($qjobs->num_rows() > 0) { # - initialization $cntposts = $post->cntposts; foreach ($qjobs->result() as $job) { if ($cntposts >= $ap_posts_limit && $ap_enabled == 1) { $time = $ap_posts_time * 60; $cntposts = 0; $this->db->query("UPDATE cronjobs SET timestamp=timestamp+" . $time . " WHERE id_post='" . $post->id . "' AND status!='1'"); break; } $access_token = !empty($job->page_access_token) ? $job->page_access_token : $post->access_token; $appsecret_proof = hash_hmac('sha256', $access_token, $this->faceboook->app_secret); $access_token_exp = explode('###', $access_token); $remove_proof = false; if (count($access_token_exp) == 2) { $access_token = $access_token_exp[0]; $remove_proof = $access_token_exp[1]; } # - track clicks $post->link = $track_clicks == 1 ? site_url('index.php/cron/redirect/' . url_encode($job->id_cron)) : $post->link; # - spintax $post->message = $this->general->spintax($this->general->xpback($post->message)); $post->link = $this->general->spintax($post->link); $post->picture = $this->general->spintax($post->picture); $post->name = $this->general->spintax($this->general->xpback($post->name)); $post->caption = $this->general->spintax($this->general->xpback($post->caption)); $post->description = $this->general->spintax($this->general->xpback($post->description)); # - trigger $fapi = $this->facebook->build($post, $job, $access_token, $appsecret_proof, $remove_proof); if (isset($fapi['id'])) { $this->db->query("UPDATE cronjobs SET status='1', error_log='', permalink='" . $fapi['id'] . "', timestamp='" . $timestamp . "' WHERE id='" . $job->id_cron . "'"); } else { if (isset($fapi['error'])) { $this->db->query("UPDATE cronjobs SET retry=retry+1, status='2', error_log='0', timestamp=timestamp+600 WHERE id='" . $job->id_cron . "'"); $this->db->query("INSERT INTO error_log(id_cron, error) VALUE('" . $job->id_cron . "', '" . $this->general->xss_post($fapi['error']) . "');"); } else { $this->db->query("UPDATE cronjobs SET retry=retry+1, status='2', error_log='0', timestamp=timestamp+600 WHERE id='" . $job->id_cron . "'"); $this->db->query("INSERT INTO error_log(id_cron, error) VALUE('" . $job->id_cron . "', '" . $this->general->xss_post(print_r($fapi['error'], true)) . "');"); } } $cntposts++; } # - update cntposts if ($ap_enabled == 1) { $this->db->query("UPDATE posts SET cntposts='" . $cntposts . "' WHERE id='" . $post->id . "'"); } } } } # - repeat until date $this->schedules->repeat_post_until($user->id, $user->gmt_zone); # - delete completed $this->schedules->delete_completed($user->id); # - pause completed $this->schedules->pause_completed($user->id); } } echo 'CRON - DONE' . "\n"; }
function index($view = FALSE) { $board =& $this->board; $member =& $this->member; $wr_field =& $this->wr_field; $seg =& $this->seg; $param =& $this->param; $wr_id = $seg->get('wr_id'); // 게시물아이디 $page = $seg->get('page', 1); // 페이지 $qstr = $seg->replace('wr_id') . $param->output(); $sst = $param->get('sst'); // 정렬필드 $sod = $param->get('sod'); // 정렬순서 $sfl = $param->get('sfl'); // 검색필드 $stx = $param->get('stx'); // 검색어 $sca = $param->get('sca'); // 분류 $spt = $param->get('spt'); // 검색 파트 $js = array('board'); // JavaScript Files if ($member['mb_level'] < $board['bo_list_level']) { if (IS_MEMBER) { alert('목록을 볼 권한이 없습니다.'); } else { alert("목록을 볼 권한이 없습니다.\\n\\n회원이라면 로그인 후 이용하세요.", 'member/login/qry/' . url_encode('board/' . BO_TABLE . '/lists' . $qstr)); } } // 분류 사용 여부 $sca_str = $sca ? '?sca=' . $sca : ''; $category = FALSE; if ($board['bo_use_category']) { $this->load->helper('category'); $category = make_category(array('type' => 'bo_' . BO_TABLE, 'id' => 'ca_code', 'code' => $sca, 'lst' => TRUE)); } // 검색 파트 row $search_part = $this->config->item('cf_search_part'); $btn_prev_part = $btn_next_part = ''; // 분류 선택, 검색어, 검색 파트 적용 if ($sca || $sfl && $stx || $board['bo_count_write'] > $search_part) { if ($stx) { $stx = get_text($stx); } $min_spt = $board['bo_min_wr_num']; if (!$spt) { $spt = $min_spt; } $total_count = $this->Board_model->list_count(BO_TABLE, $spt, $sca, $sfl, $stx); $prev_spt = $spt - $search_part; if ($min_spt && $prev_spt >= $min_spt) { $btn_prev_part = '<li><a href="' . RT_PATH . '/board/' . BO_TABLE . '/lists' . $param->replace('spt', $prev_spt, $qstr) . '">이전검색</a></li>'; } $next_spt = $spt + $search_part; if ($next_spt < 0) { $btn_next_part = '<li><a href="' . RT_PATH . '/board/' . BO_TABLE . '/lists' . $param->replace('spt', $next_spt, $qstr) . '">다음검색</a></li>'; } } else { $total_count = $board['bo_count_write']; } $config['suffix'] = $qstr; $config['base_url'] = RT_PATH . '/board/' . BO_TABLE . '/lists/page/'; $config['per_page'] = $board['bo_page_rows']; $config['total_rows'] = $total_count; $config['uri_segment'] = $seg->pos('page'); // 검색 파트 ADD $config['full_tag_open'] = '<ul class="pagination">' . $btn_prev_part; $config['full_tag_close'] = $btn_next_part . '</ul>'; $CI =& get_instance(); $CI->load->library('pagination', $config); // 정렬 if (!$sst) { if ($board['bo_sort_field']) { $sst = $board['bo_sort_field']; } else { $sst = 'wr_num, wr_reply'; $sod = 'asc'; } } else { $sst = preg_match("/^(wr_datetime|wr_hit)\$/i", $sst) ? $sst : FALSE; } $offset = ($page - 1) * $config['per_page']; $result = $this->Board_model->list_result(BO_TABLE, $spt, $sca, $sst, $sod, $sfl, $stx, $config['per_page'], $offset, $wr_field); // 사이드 뷰 if ($board['bo_use_sideview']) { $this->load->helper('sideview'); } // 일반 리스트 $list = $wr_ids = array(); foreach ($result as $i => $row) { $row = get_convert($row, $board, $board['bo_subject_len'], $qstr, TRUE); $list[$i] = new stdClass(); $list[$i]->num = $total_count - ($page - 1) * $config['per_page'] - $i; $list[$i]->href = $row['href']; $list[$i]->wr_id = $row['wr_id']; $list[$i]->subject = strpos($sfl, 'subject') ? search_font($row['subject'], $stx) : $row['subject']; $list[$i]->comment_cnt = $row['comment_cnt']; $list[$i]->name = $row['name']; $list[$i]->datetime2 = $row['datetime2']; $list[$i]->wr_hit = $row['wr_hit']; $list[$i]->ico_reply = $row['ico_reply']; $list[$i]->ico_new = $row['ico_new']; $list[$i]->ico_hot = $row['ico_hot']; $list[$i]->ico_secret = $row['ico_secret']; $list[$i]->ico_file = $row['ico_file']; $list[$i]->ico_image = $row['ico_image']; $list[$i]->ico_movie = $row['ico_movie']; $wr_ids[$row['wr_id']] = $i; } // Extra if ($board['bo_use_extra'] && $wr_ids) { $result = $this->Board_model->get_extra(BO_TABLE, array_keys($wr_ids)); foreach ($result as $row) { $i = $wr_ids[$row['wr_id']]; foreach ($row as $fld => $val) { $list[$i]->{$fld} = $val; } } } // 공지사항 리스트 if (!$sca && !$stx) { $notice = explode(',', trim($board['bo_notice'])); if ($notice[0]) { $result = $this->Board_model->list_notice(BO_TABLE, $notice, $wr_field); $list_nt = array(); foreach ($result as $i => $row) { $row = get_convert($row, $board, $board['bo_subject_len'], $qstr, TRUE); $list_nt[$i] = new stdClass(); $list_nt[$i]->href = $row['href']; $list_nt[$i]->wr_id = $row['wr_id']; $list_nt[$i]->subject = $row['subject']; $list_nt[$i]->comment_cnt = $row['comment_cnt']; $list_nt[$i]->name = $row['name']; $list_nt[$i]->datetime2 = $row['datetime2']; $list_nt[$i]->wr_hit = $row['wr_hit']; } } } // 리스트 버튼 $btn_list = ''; if ($sfl && $stx) { $btn_list = '<a href="' . RT_PATH . '/board/' . BO_TABLE . '/lists' . $sca_str . '" class="btn btn-warning">목록</a>'; } // 글쓰기 버튼 $btn_write = ''; if ($board['bo_use_private'] && !IS_ADMIN) { $btn_write = FALSE; } elseif ($member['mb_level'] >= $board['bo_write_level']) { $btn_write = '<a href="' . RT_PATH . '/board/' . BO_TABLE . '/write' . $sca_str . '" class="btn btn-primary"><span class="glyphicon glyphicon-pencil"></span> 글쓰기</a>'; } // RSS 버튼 $btn_rss = ''; if ($board['bo_use_rss']) { $btn_rss = '<a href="' . RT_PATH . '/board/' . BO_TABLE . '/rss" class="btn btn-xs btn-warning" target="_blank">RSS</a>'; } // 관리자 버튼 $btn_admin = ''; if (SU_ADMIN) { $btn_admin = '<a href="' . RT_PATH . '/' . ADM_F . '/board/form/u/' . BO_TABLE . '" class="btn btn-xs btn-primary" target="_blank">관리자</a>'; } else { if (IS_ADMIN) { $btn_admin = '<button type="button" class="btn btn-xs btn-primary" onclick="board_admin();">관리자</button>'; } } // 관리자 체크박스 및 버튼 표시xsxs $btn_chkbox = ''; if (IS_ADMIN) { $btn_chkbox = '<button type="button" class="btn btn-danger" onclick="select_delete();">선택삭제</button>'; if (SU_ADMIN || IS_ADMIN == 'group') { $btn_chkbox .= '<button type="button" class="btn btn-info" onclick="select_copy(\'copy\');">선택복사</button>'; $btn_chkbox .= '<button type="button" class="btn btn-info" onclick="select_copy(\'move\');">선택이동</button>'; } } // 정렬 링크 $head = array('title' => $board['gr_subject'] . ' > ' . $board['bo_subject'], 'sca' => $sca); $data = array('total_count' => $total_count, 'category' => $category, 'btn_list' => $btn_list, 'btn_write' => $btn_write, 'btn_rss' => $btn_rss, 'btn_admin' => $btn_admin, 'btn_chkbox' => $btn_chkbox, 'wr_id' => $wr_id, 'sca' => $sca, 'sfl' => $sfl, 'stx' => $stx, 'list' => $list, 'list_nt' => isset($list_nt) ? $list_nt : array(), 'paging' => $CI->pagination->create_links(), 'sort_datetime' => $param->sort('wr_datetime', 'desc'), 'sort_hit' => $param->sort('wr_hit', 'desc')); if ($view) { $this->load->view('board/' . $board['bo_skin'] . '/list', $data); } else { // JavaScript Load if (IS_ADMIN) { $js[] = 'board_check'; } if ($board['bo_use_sideview']) { $js[] = 'sideview'; } if ($board['bo_use_category']) { $js[] = 'category'; } widget::run('head', $head); $this->load->view('board/' . $board['bo_skin'] . '/list', $data); widget::run('tail', array('js' => $js)); } }
/** * Returns sanitized url for the selected field * @param string $key Key name or input value (direct input must be enabled) * @param boolean $encoded Optional. Encode url string. Defaults to false * @return string */ public function urlVal($key, $encoded = false) { $v = $this->value($key); if (!is_array($v)) { $v = trim(str_replace(self::$badCharacters, '', strip_tags($v))); $v = $encoded ? url_encode($v) : $v; } else { foreach ($v as $k => $b) { $b = trim(str_replace(self::$badCharacters, '', strip_tags($b))); $v[$k] = $encoded ? url_encode($b) : $b; } } return $v; }
function make_list($parent = 0, &$editable_pages = 0) { // Get objects and vars from outside this function global $admin, $database, $TEXT, $MESSAGE, $HEADING, $par; $template = new Template(THEME_PATH . '/templates'); $template->set_file('pages_list_loop_file', 'pages_list_loop.htt'); $template->set_block('pages_list_loop_file', 'main_block', 'main'); $template->set_block('main_block', 'page_list_loop_block', 'page_list_loop'); $template->set_block('page_list_loop_block', 'page_sublist_loop_block', 'page_sublist_loop'); $template->set_var('PARENT', $parent); $template->set_var('ADMIN_URL', ADMIN_URL); $template->set_var('THEME_URL', THEME_URL); $template->set_block('page_sublist_loop_block', 'link_view_block', 'link_view'); $template->set_block('page_sublist_loop_block', 'link_settings_block', 'link_settings'); $template->set_block('page_sublist_loop_block', 'link_restore_block', 'link_restore'); $template->set_block('page_sublist_loop_block', 'link_manage_active_block', 'link_manage_active'); $template->set_block('page_sublist_loop_block', 'link_manage_inactive_block', 'link_manage_inactive'); $template->set_block('page_sublist_loop_block', 'link_manage_no_date_block', 'link_manage_no_date'); $template->set_block('page_sublist_loop_block', 'link_move_up_block', 'link_move_up'); $template->set_block('page_sublist_loop_block', 'link_move_down_block', 'link_move_down'); $template->set_block('page_sublist_loop_block', 'link_delete_block', 'link_delete'); $template->set_block('page_sublist_loop_block', 'link_add_block', 'link_add'); if (!isset($_COOKIE["p" . $parent])) { $_COOKIE["p" . $parent] = "1"; } if (isset($_COOKIE['p' . $parent]) && $_COOKIE['p' . $parent] == '1') { $template->set_var('DISPLAY', ' style="display:block"'); } else { $template->set_var('DISPLAY', ' style="display:none"'); } // Get page list from database $sql = 'SELECT * FROM `' . TABLE_PREFIX . 'pages` WHERE `parent` = ' . $parent . ' '; $sql .= PAGE_TRASH != 'inline' ? 'AND `visibility` != \'deleted\' ' : ' '; $sql .= 'ORDER BY `position` ASC'; $get_pages = $database->query($sql); $loop = ''; // Insert values into main page list if ($get_pages->numRows() > 0) { /** * Get the info out of the loop to get rit of fifty+x methods-calls. */ $admin_get_perm = $admin->get_permission('pages_modify'); $admin_user_id = $admin->get_user_id(); while ($page = $get_pages->fetchRow(MYSQL_ASSOC)) { $template->set_var('TEXT_EXPAND', $TEXT['EXPAND']); $template->set_var('TEXT_COLLAPSE', $TEXT['COLLAPSE']); $template->set_var('TEXT_MODIFY', $TEXT['MODIFY']); $template->set_var('TEXT_VIEW', $TEXT['VIEW']); $template->set_var('TEXT_SETTINGS', $TEXT['SETTINGS']); $template->set_var('TEXT_RESTORE', $TEXT['RESTORE']); $template->set_var('TEXT_MOVE_UP', $TEXT['MOVE_UP']); $template->set_var('TEXT_MOVE_DOWN', $TEXT['MOVE_DOWN']); $template->set_var('TEXT_DELETE', $TEXT['DELETE']); $template->set_var('HEADING_MANAGE_SECTIONS', $HEADING['MANAGE_SECTIONS']); $template->set_var('HEADING_ADD_PAGE', $HEADING['ADD_PAGE']); $template->set_var('PAGE_TITLE', $page['page_title']); // # Aldus 1 $template->set_var('MENU_TITLE', $page['menu_title']); // # Aldus 2 $template->set_var('PAGE_LINK', $page['link'] . PAGE_EXTENSION); $template->set_var('PAGE_ID', $page['page_id']); $template->set_var('PAGE_URL', $admin->page_link($page['link'])); // Get user perms $admin_groups = explode(',', str_replace('_', '', $page['admin_groups'])); $admin_users = explode(',', str_replace('_', '', $page['admin_users'])); $in_group = FALSE; foreach ($admin->get_groups_id() as $cur_gid) { if (in_array($cur_gid, $admin_groups)) { $in_group = TRUE; } } if ($in_group || is_numeric(array_search($admin_user_id, $admin_users))) { if ($page['visibility'] == 'deleted') { if (PAGE_TRASH == 'inline') { $can_modify = true; $editable_pages++; } else { $can_modify = false; } } elseif ($page['visibility'] != 'deleted') { $can_modify = true; $editable_pages++; } } else { if ($page['visibility'] == 'private') { continue; } else { $can_modify = false; } } $admin_can_modify = $admin_get_perm && $can_modify; // Work out if we should show a plus or not $sql = 'SELECT `page_id`,`admin_groups`,`admin_users` FROM `' . TABLE_PREFIX . 'pages` WHERE `parent` = ' . $page['page_id'] . ' '; if (PAGE_TRASH != 'inline') { $sql .= 'AND `visibility` != \'deleted\' '; } $get_page_subs = $database->query($sql); $num_subs = $get_page_subs->numRows(); $par['num_subs'] = $num_subs; // why this? // Work out how many pages there are for this parent $num_pages = $get_pages->numRows(); $display_plus = $num_subs > 0 ? true : false; $template->set_var('LEVEL', $page['level']); $template->set_var('EXPAND', ''); if (true === $display_plus) { // print_r($_COOKIE); $sign = 'plus'; if (!isset($_COOKIE['p' . $page['page_id']])) { $_COOKIE['p' . $page['page_id']] = '0'; } if (isset($_COOKIE['p' . $page['page_id']]) && $_COOKIE['p' . $page['page_id']] == '1') { $sign = 'minus'; } $theme_url = THEME_URL; $expand = <<<EXPAND <a href="javascript:toggle_visibility('p{$page['page_id']}');" title="{$TEXT['EXPAND']}/{$TEXT['COLLAPSE']}"> <img src="{$theme_url}/images/{$sign}_16.png" onclick="toggle_plus_minus('{$page['page_id']}');" name="plus_minus_{$page['page_id']}" alt="+" /> </a> EXPAND; $template->set_var('EXPAND', $expand); } // end Aldus: #2 switch ($page['visibility']) { case 'public': $img = "visible_16.png"; $t = $TEXT['PUBLIC']; break; case 'private': $img = "private_16.png"; $t = $TEXT['PRIVATE']; break; case 'registered': $img = "keys_16.png"; $t = $TEXT['REGISTERED']; break; case 'hidden': $img = "hidden_16.png"; $t = $TEXT['HIDDEN']; break; case 'none': $img = "none_16.png"; $t = $TEXT['NONE']; break; case 'deleted': $img = "deleted_16.png"; $t = $TEXT['DELETED']; break; default: $img = ""; $t = "No matches found in admins/pages/index.php for the visibility!"; } $img_visibility = "<img src='" . THEME_URL . "/images/" . $img . "' alt='" . $TEXT['VISIBILITY'] . ":" . $t . "' class='page_list_rights' />\n"; $template->set_var('IMG_VISIBILITY', $img_visibility); if (true === $admin_can_modify) { $template->set_var('MODIFY_URL', ADMIN_URL . "/pages/modify.php?page_id=" . $page['page_id']); } if ($page['visibility'] != 'deleted' && $page['visibility'] != 'none') { $template->parse('link_view', 'link_view_block'); } else { $template->parse('link_view', ''); } if ($page['visibility'] != 'deleted' && $admin->get_permission('pages_settings') == true && $can_modify == true) { $template->parse('link_settings', 'link_settings_block'); $template->parse('link_restore', ''); } else { $template->parse('link_restore', 'link_restore_block'); $template->parse('link_settings', ''); } // Work-out if we should show the "manage dates" link if (MANAGE_SECTIONS == 'enabled' && $admin->get_permission('pages_modify') == true && $can_modify == true) { $sql = 'SELECT `publ_start`, `publ_end` FROM `' . TABLE_PREFIX . 'sections` '; $sql .= 'WHERE `page_id` = ' . $page['page_id'] . ' AND `module` != \'menu_link\' '; $query_sections = $database->query($sql); if ($query_sections->numRows() > 0) { $mdate_display = false; while ($mdate_res = $query_sections->fetchRow(MYSQL_ASSOC)) { if ($mdate_res['publ_start'] != '0' || $mdate_res['publ_end'] != '0') { $mdate_display = true; break; } } if ($mdate_display == 1) { if ($admin->page_is_active($page)) { $template->parse('link_manage_active', 'link_manage_active_block'); } else { $template->parse('link_manage_inactive', 'link_manage_inactive_block'); } $template->parse('link_manage_no_date', ''); } else { $template->parse('link_manage_active', ''); $template->parse('link_manage_inactive', ''); $template->parse('link_manage_no_date', 'link_manage_no_date_block'); } } } if ($page['position'] != 1 && $page['visibility'] != 'deleted' && $admin->get_permission('pages_settings') == true && $can_modify == true) { $template->parse('link_move_up', 'link_move_up_block'); } else { $template->parse('link_move_up', ''); } if ($page['position'] != $num_pages && $page['visibility'] != 'deleted' && $admin->get_permission('pages_settings') == true && $can_modify == true) { $template->parse('link_move_down', 'link_move_down_block'); } else { $template->parse('link_move_down', ''); } if ($admin->get_permission('pages_delete') == true && $can_modify == true) { $okstring = str_replace(array(':', '@', '\''), array(':', '@', "′"), url_encode($page['page_title'])); #, ENT_QUOTES)); $s = sprintf($MESSAGE['PAGES_DELETE_CONFIRM'], $okstring); $template->set_var('MESSAGE_PAGES_DELETE_CONFIRM', $s); $template->parse('link_delete', 'link_delete_block'); } else { $template->parse('link_delete', ''); } if ($admin->get_permission('pages_add') == true && $can_modify == true && $page['visibility'] != 'deleted') { $template->parse('link_add', 'link_add_block'); } else { $template->parse('link_add', ''); } if ($page['parent'] == 0) { $page_tmp_id = $page['page_id']; } // Get subs $template->set_var('LOOP', make_list($page['page_id'], $editable_pages)); $template->parse('page_sublist_loop', 'page_sublist_loop_block', true); } ob_start(); $template->set_var('PARENT', $parent); if (isset($_COOKIE['p' . $parent]) && $_COOKIE['p' . $parent] == '1') { $template->set_var('DISPLAY', ' style="display:block"'); } $template->parse('page_list_loop', 'page_list_loop_block'); $template->parse('main', 'main_block'); $template->pparse('output', 'pages_list_loop_file'); $loop = ob_get_clean(); } $par['num_subs'] = empty($output) ? 1 : $par['num_subs']; return $loop; }
function pathways() { // needs to be finished return; while ($l = $this->getReadFile()->read(50000)) { $a = explode("\t", trim($l)); // From To Reaction Type Controller Control Type Cell Type PubMed Id Genes Drugs Diseases // hmg coa reductase inhibitors Active & Inactive metabolites Biochemical Reaction CYP2C19,CYP2C8,CYP2C9,CYP2D6,CYP3A4,CYP3A5,UGT1A1,UGT1A3,UGT2B7 Catalysis hepatocyte CYP3A4,CYP3A5,UGT1A3,CYP2C19,CYP2C9,CYP2C8,CYP2D6,UGT1A1,UGT2B7 hmg coa reductase inhibitors $c1 = array_search($a[0], $this->drugs); if ($c1 === FALSE) { $c1 = array_search($a[0], $this->genes); if ($c1 === FALSE) { $c1 = parent::getRes() . url_encode($c1); } else { $c1 = parent::getNamespace() . $c1; } } $c2 = array_search($a[1], $this->drugs); if ($c2 === FALSE) { $c2 = array_search($a[1], $this->genes); if ($c2 === FALSE) { // not found $c2 = parent::getRes() . url_encode($c2); } else { // actual id $c2 = parent::getNamespace() . $c2; } } $id = md5($l); $uri = parent::getRes() . $id; parent::writeRDFBufferToWriteFile(); } }
function index() { $board =& $this->board; $member =& $this->member; $write =& $this->write; $seg =& $this->seg; $param =& $this->param; $w = $seg->get('w'); // 모드 $wr_id = $seg->get('wr_id'); // 게시물아이디 $qstr = $seg->output() . $param->output(); $sca = $param->get('sca'); // 분류 $js = array('jquery/validate'); // JavaScript Files // 개인게시판 권한 if ($board['bo_use_private'] && !IS_ADMIN) { alert('작성 권한이 없습니다.'); } // I will be back. $return_url = url_encode('board/' . BO_TABLE . '/write' . $qstr); // 공지사항 $notice_array = explode(',', trim($board['bo_notice'])); if ($w == 'u' || $w == 'r') { if (!isset($write['wr_id'])) { alert("글이 존재하지 않습니다.\\n\\n삭제되었거나 이동된 경우입니다.", 'board/' . BO_TABLE . '/lists'); } $sca = $write['ca_code']; } if ($w == '') { if ($wr_id) { alert('글쓰기에는 wr_id 값을 사용하지 않습니다.', 'board/' . BO_TABLE); } if ($member['mb_level'] < $board['bo_write_level']) { if (IS_MEMBER) { alert('글을 쓸 권한이 없습니다.'); } else { alert("글을 쓸 권한이 없습니다.\\n\\n회원이라면 로그인 후 이용하세요.", "member/login/qry/" . $return_url); } } $title_msg = '글쓰기'; } else { if ($w == 'u') { if (IS_MEMBER && $write['mb_id'] == $member['mb_id']) { // 자신의 글이면 통과 } else { if ($member['mb_level'] < $board['bo_write_level']) { if (IS_MEMBER) { alert('글을 수정할 권한이 없습니다.'); } else { alert("글을 수정할 권한이 없습니다.\\n\\n회원이라면 로그인 후 이용하세요.", "member/login/qry/" . $return_url); } } } // 수정 권한 IF if (IS_ADMIN == 'group' || IS_ADMIN == 'board') { $mb = $this->Basic_model->get_member($write['mb_id'], 'mb_level'); $mb_level = isset($mb['mb_level']) ? $mb['mb_level'] : 1; } if (IS_ADMIN == 'super') { // 통과 } else { if (IS_ADMIN == 'group') { // 그룹관리자 if ($member['mb_id'] == $board['gr_admin']) { // 자신이 관리하는 그룹인가 if ($member['mb_level'] < $mb_level) { // 자신의 레벨이 낮다면 alert('그룹관리자의 권한보다 높은 회원의 글이므로 수정할 수 없습니다.'); } } else { alert('자신이 관리하는 그룹의 게시판이 아니므로 글을 수정할 수 없습니다.'); } } else { if (IS_ADMIN == 'board') { // 게시판관리자 if ($member['mb_id'] == $board['bo_admin']) { // 자신이 관리하는 게시판인가 if ($member['mb_level'] < $mb_level) { // 자신의 레벨이 낮다면 alert('게시판관리자의 권한보다 높은 회원의 글이므로 수정할 수 없습니다.'); } } else { alert('자신이 관리하는 게시판이 아니므로 글을 수정할 수 없습니다.'); } } else { if ($write['mb_id']) { if (!IS_MEMBER || $member['mb_id'] != $write['mb_id']) { alert('자신의 글이 아니므로 수정할 수 없습니다.'); } } else { $CI =& get_instance(); $CI->load->library('encrypt'); if (md5($this->input->post('password')) !== $CI->encrypt->decode($write['wr_password'])) { alert('비밀번호가 맞지 않습니다.'); } } } } } // 원글만 구한다. $cnt = $this->Board_model->is_reply(BO_TABLE, $wr_id, $write['wr_num'], $write['wr_reply']); if ($cnt && !IS_ADMIN) { alert("이 글과 관련된 답변글이 존재하므로 수정할 수 없습니다.\\n\\n답변글이 있는 원글은 수정할 수 없습니다."); } // 댓글 달린 원글의 수정 여부 if ($board['bo_count_modify'] > 0) { $cnt = $this->Board_model->is_comment(BO_TABLE, $wr_id, IS_MEMBER ? $member['mb_id'] : ''); if ($cnt >= $board['bo_count_modify'] && !IS_ADMIN) { alert("이 글과 관련된 댓글가 존재하므로 수정할 수 없습니다.\\n\\n댓글가 " . $board['bo_count_modify'] . "건 이상 달린 원글은 수정할 수 없습니다."); } } $title_msg = '글수정'; } else { if ($w == 'r') { if ($member['mb_level'] < $board['bo_reply_level']) { if (IS_MEMBER) { alert('글을 답변할 권한이 없습니다.'); } else { alert("글을 답변할 권한이 없습니다.\\n\\n회원이라면 로그인 후 이용하세요.", "member/login/qry/" . $return_url); } } if (in_array((int) $wr_id, $notice_array)) { alert('공지에는 답변 할 수 없습니다.'); } // 비밀글인지를 검사 if (strpos($write['wr_option'], 'secret') !== FALSE) { if ($write['mb_id']) { // 회원의 경우는 해당 글쓴 회원 및 관리자 if (!($write['mb_id'] == $member['mb_id'] || IS_ADMIN)) { alert('비밀글에는 자신 또는 관리자만 답변이 가능합니다.'); } } else { // 비회원의 경우는 비밀글에 답변이 불가함 if (!IS_ADMIN) { alert('비회원의 비밀글에는 답변이 불가합니다.'); } } } // 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다. if (strlen($write['wr_reply']) == 10) { alert("더 이상 답변하실 수 없습니다.\\n\\n답변은 10단계 까지만 가능합니다."); } $reply = $this->Board_model->get_reply_step(BO_TABLE, $write['wr_num'], $board['bo_reply_order'], $write['wr_reply']); $title_msg = '글답변'; } else { alert('잘못된 접근입니다.'); } } } $notice_checked = $secret_checked = 0; // check 필드 $is_notice = $is_nocomt = FALSE; if (IS_ADMIN) { if ($board['bo_use_comment']) { $is_nocomt = TRUE; } if ($w != 'r') { $is_notice = TRUE; if ($w == 'u') { // 답변 수정시 공지 체크 없음 if ($write['wr_reply']) { $is_notice = FALSE; } else { $notice_checked = in_array((int) $wr_id, $notice_array) ? 1 : 0; } } } } $is_secret = $board['bo_use_secret']; $is_editor = $board['bo_use_editor'] ? TRUE : FALSE; $is_email = $this->config->item('cf_use_email') && $board['bo_use_email'] && $this->config->item('cf_email_wr_write') ? TRUE : FALSE; $is_sign = !IS_MEMBER || IS_ADMIN && $w == 'u' && $member['mb_id'] != $write['mb_id'] ? TRUE : FALSE; // 분류 $category = FALSE; if ($board['bo_use_category']) { $this->load->helper('category'); $category = make_category(array('type' => 'bo_' . BO_TABLE, 'id' => 'ca_code', 'code' => $sca)); } $name = $email = ''; if ($w == '' || $w == 'r') { if (IS_MEMBER) { $name = cut_str(get_text($write['wr_name']), 20); $email = $member['mb_email']; } if ($w == 'r' && strpos($write['wr_option'], 'secret') !== FALSE) { $is_secret = TRUE; $secret_checked = 1; } } else { if ($w == 'u') { $name = cut_str(get_text($write['wr_name']), 20); $email = $write['wr_email']; if (strpos($write['wr_option'], 'secret') !== FALSE) { $secret_checked = 1; } } } // 히든 옵션 $option_hidden = ''; if ($is_editor) { $option_hidden .= "<input type='hidden' name='editor' value='editor' />"; } // 옵션 박스 $option = $option_check = array(); if ($is_notice) { $option['notice'] = array('title' => '공지', 'value' => '1'); $option_check['notice'] = $notice_checked; } if ($is_secret) { if (IS_ADMIN || $is_secret == 1) { $option['secret'] = array('title' => '비밀글', 'value' => 'secret'); $option_check['secret'] = $secret_checked; } else { $option_hidden .= "<input type='hidden' name='secret' value='secret' />"; } } if ($is_email) { $option['mail'] = array('title' => '답변메일받기', 'value' => 'mail'); $option_check['mail'] = $w == 'u' && strpos($write['wr_option'], 'mail') !== FALSE ? 1 : 0; } if ($is_nocomt) { $option['nocomt'] = array('title' => '댓글금지', 'value' => 'nocomt'); $option_check['nocomt'] = strpos($write['wr_option'], 'nocomt') !== FALSE ? 1 : 0; } // 제목 $subject = cut_str(get_text($write['wr_subject']), 255); // 내용 if ($w == '') { $content = $board['bo_insert_content']; } else { if ($w == 'r') { $subject = ''; $content = $board['bo_insert_content']; } else { if ($is_editor) { $content = str_replace('&', '&', $write['wr_content']); } else { $content = get_text($write['wr_content']); } } } // 에디터 $editor = $editorConfig = ''; if ($is_editor) { $attach = array(); if ($w == 'u' && ($write['wr_count_file'] || $write['wr_count_image'])) { $CI =& get_instance(); $CI->load->model('Board_file_model'); $result = $CI->Board_file_model->get_files(BO_TABLE, $wr_id, 'bf_no,bf_editor,bf_source,bf_file,bf_filesize', 'all'); $base_url = $this->config->item('base_url'); foreach ($result as $row) { $filename = $row['bf_source']; if ($row['bf_editor']) { $filepath = $base_url . DATA_DIR . '/file/' . BO_TABLE . '/' . $row['bf_file']; $attach['image'][] = array('attacher' => 'image', 'data' => array('imageurl' => $filepath, 'filename' => $filename, 'filesize' => (int) $row['bf_filesize'], 'thumburl' => $filepath)); } else { $attach['file'][] = array('attacher' => 'file', 'data' => array('attachurl' => $base_url . RT_PATH . '/board/' . BO_TABLE . '/download/wr_id/' . $wr_id . '/no/' . $row['bf_no'], 'filemime' => 'application/octet-stream', 'filename' => $filename, 'filesize' => (int) $row['bf_filesize'])); } } } $editorConfig = array('editor' => array('initializedId' => '1', 'wrapper' => 'tx_trex_container', 'form' => 'fwrite', 'field' => 'wr_content', 'content' => $content, 'attachments' => $attach)); $editor = $this->load->view('board/editor', $editorConfig['editor'], TRUE); $content = ''; // 그냥 비우기 } // SyntaxHighlighter $syntax = FALSE; if ($board['bo_use_syntax'] && $is_editor) { $this->load->config('cf_syntax'); $syntax = $this->config->item('brush_name'); } $head = array('title' => $board['gr_subject'] . ' > ' . $board['bo_subject'] . ' > ' . $title_msg, 'sca' => $sca ? str_replace('.', '-', $sca) : ''); $data = array('title_msg' => $title_msg, 'w' => $w, 'wr_id' => $wr_id, 'sca_str' => $sca ? '?sca=' . $sca : '', 'qstr' => $param->replace('w,wr_id'), 'mb_id' => !$w && IS_MEMBER ? $member['mb_id'] : 'guest', 'name' => $name, 'email' => $email, 'subject' => $subject, 'content' => $content, 'editor' => $editor, 'editorConfig' => json_encode($editorConfig), 'option' => $option, 'option_check' => json_encode($option_check), 'option_hidden' => $option_hidden, 'category' => $category, 'is_editor' => $is_editor, 'is_sign' => $is_sign, 'syntax' => $syntax); // Extra if ($board['bo_use_extra']) { if ($w == 'u') { $data = array_merge($data, $this->Board_model->get_extra(BO_TABLE, $wr_id)); } else { $extra = $this->db->list_fields('ki_extra_' . BO_TABLE); foreach ($extra as $fld) { if ($fld == 'wr_id') { continue; } $data[$fld] = FALSE; } } } // JavaScript Load if ($is_editor) { $js[] = '../editor/js/editor_loader'; $js[] = 'editor_config'; } if (!IS_MEMBER) { $js[] = 'md5'; $js[] = 'kcaptcha'; } if ($board['bo_use_category']) { $js[] = 'category'; } widget::run('head', $head); $this->load->view('board/' . $board['bo_skin'] . '/write', $data); widget::run('tail', array('js' => $js)); }
/** * @see FrontController::initContent() */ public function initContent() { parent::initContent(); $fb_connect_appid = Configuration::get('FB_CONNECT_APPID'); $fb_connect_appkey = Configuration::get('FB_CONNECT_APPKEY'); $this->login_url = $this->context->link->getModuleLink('fbconnect_psb', 'login', array(), TRUE, $this->context->language->id); require_once _PS_ROOT_DIR_ . '/modules/fbconnect_psb/fb_sdk/facebook.php'; $facebook = new Facebook(array('appId' => $fb_connect_appid, 'secret' => $fb_connect_appkey)); // Get User ID $user = $facebook->getUser(); // We may or may not have this data based on whether the user is logged in. // // If we have a $user id here, it means we know the user is logged into // Facebook, but we don't know if the access token is valid. An access // token is invalid if the user logged out of Facebook. if ($user) { try { // Proceed knowing you have a logged in user who's authenticated. $fb_user_profile = $facebook->api('/me'); } catch (FacebookApiException $e) { //die('Error: '.$e); error_log($e); $user = null; } } else { // Get new Access tokens Tools::redirect($facebook->getLoginUrl(array('scope' => 'email'))); } // current user state Logged In with FB if ($user) { //get the user email from DB with FB ID $sql = 'SELECT c.`email` FROM `' . _DB_PREFIX_ . 'customer` c LEFT JOIN `' . _DB_PREFIX_ . 'customer_profile_connect` pc ON pc.id_customer = c.id_customer WHERE pc.`facebook_id` = ' . (int) $fb_user_profile['id'] . Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'c'); $email = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); if (empty($email)) { Tools::redirect($this->context->link->getModuleLink('fbconnect_psb', 'registration', array(), TRUE, $this->context->language->id)); } else { $customer = new Customer(); $authentication = $customer->getByEmail(trim($email)); if (!$authentication || !$customer->id) { $this->errors[] = Tools::displayError('Error: Authentication failed.'); } else { $this->context->cookie->id_compare = isset($this->context->cookie->id_compare) ? $this->context->cookie->id_compare : CompareProduct::getIdCompareByIdCustomer($customer->id); $this->context->cookie->id_customer = (int) $customer->id; $this->context->cookie->customer_lastname = $customer->lastname; $this->context->cookie->customer_firstname = $customer->firstname; $this->context->cookie->logged = 1; $customer->logged = 1; $this->context->cookie->is_guest = $customer->isGuest(); $this->context->cookie->passwd = $customer->passwd; $this->context->cookie->email = $customer->email; // Add customer to the context $this->context->customer = $customer; if (Configuration::get('PS_CART_FOLLOWING') && (empty($this->context->cookie->id_cart) || Cart::getNbProducts($this->context->cookie->id_cart) == 0) && ($id_cart = (int) Cart::lastNoneOrderedCart($this->context->customer->id))) { $this->context->cart = new Cart($id_cart); } else { $this->context->cart->id_carrier = 0; $this->context->cart->setDeliveryOption(null); $this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int) $customer->id); $this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int) $customer->id); } $this->context->cart->id_customer = (int) $customer->id; $this->context->cart->secure_key = $customer->secure_key; $this->context->cart->save(); $this->context->cookie->id_cart = (int) $this->context->cart->id; $this->context->cookie->update(); $this->context->cart->autosetProductAddress(); Hook::exec('actionAuthentication'); // Login information have changed, so we check if the cart rules still apply CartRule::autoRemoveFromCart($this->context); CartRule::autoAddToCart($this->context); if ($back = Tools::getValue('back')) { Tools::redirect(html_entity_decode($back)); } else { Tools::redirect('index.php?controller=' . ($this->authRedirection !== false ? url_encode($this->authRedirection) : 'my-account')); } } } $this->context->smarty->assign(array('redirect_uri' => urlencode($this->login_url), 'fb_connect_appid' => $fb_connect_appid, 'fb_connect_error' => $this->errors)); $this->setTemplate('login_fb.tpl'); } else { if (isset($_GET['error']) && isset($_GET['error_code'])) { $msg = 'There was error while trying to get information from Facebook.'; $msg .= '<br>' . $_GET['error'] . ' - ' . $_GET['error_code'] . ' - ' . $_GET['error_description'] . ' - ' . $_GET['error_reason']; $this->errors[] = Tools::displayError($msg); $this->setTemplate('login_fb.tpl'); } else { Tools::redirect($facebook->getLoginUrl(array('scope' => 'email'))); } } }
/** * Escape URI * * @param $content * * @return string */ public static function uri($content) { return url_encode($content); }
if (!class_exists('admin', false)) { require WB_PATH . '/framework/class.admin.php'; } $admin = new admin('Pages', 'pages'); $admin->clearIDKEY(); // Include the WB functions file require_once WB_PATH . '/framework/functions.php'; // eggsurplus: add child pages for a specific page ?> <script type="text/javascript" src="<?php print ADMIN_URL; ?> /pages/eggsurplus.js"></script> <?php // fixes A URI contains impermissible characters or quotes around the URI are not closed. $MESSAGE['PAGES_DELETE_CONFIRM'] = url_encode($MESSAGE['PAGES_DELETE_CONFIRM']); function set_node($parent, &$par) { $retval = ''; if ($par['num_subs']) { $retval .= "\n" . '<ul id="p' . $parent . '"'; if ($parent != 0) { $retval .= ' class="page_list"'; if (isset($_COOKIE['p' . $parent]) && $_COOKIE['p' . $parent] == '1') { $retval .= ' style="display:block"'; } } $retval .= ">\n"; } return $retval; }
<td width="250" style="padding-left: 10px;"><?php echo $submission['display_name']; ?> </td> <td width="240"><?php echo $submission['email']; ?> </td> <td width="20" style="text-align: center;"> </td> <td width="20"> </td> <td width="20" style="text-align: center;"> <?php $url = WB_URL . '/modules/form/delete_submission.php?page_id=' . $page_id . '&section_id=' . $section_id . '&submission_id=' . $admin->getIDKEY($submission['submission_id']); ?> <a href="javascript: confirm_link('<?php echo url_encode($TEXT['ARE_YOU_SURE']); ?> ', '<?php echo $url; ?> ');" title="<?php echo $TEXT['DELETE']; ?> "> <img src="<?php echo THEME_URL; ?> /images/delete_16.png" border="0" alt="X" /> </a> </td> <td width="20"> </td>
/** function implode_full [implodeFull] * Much like implode, but including the keys with an * extra divider between key-value pairs * Can be used to create URL GET strings from arrays * * @param string separator between elements (for URL GET, use '&') * @param string divider between key-value pairs (for URL GET, use '=') * @param array * @param bool optional URL encode flag * @return string */ function implode_full($separator, $divider, $array, $url = false) { if (!is_array($array) || 0 == count($array)) { return $array; } $str = ''; foreach ($array as $key => $val) { $str .= $key . $divider . $val . $separator; } $str = substr($str, 0, -strlen($separator)); if ($url) { $str = url_encode($str); } return $str; }
function index() { $board =& $this->board; $member =& $this->member; $seg =& $this->seg; $param =& $this->param; $wr_id = $seg->get('wr_id'); // 게시물아이디 $qstr = $seg->output(); $dqstr = $seg->replace('wr_id') . $param->output(); $stx = $param->get('stx'); // 검색어 $sfl = $param->get('sfl'); // 검색필드 $sca = $param->get('sca'); // 분류 $js = array('board'); // JavaScript Files if ($wr_id) { $write =& $this->write; if (!isset($write['wr_id'])) { alert('글이 존재하지 않습니다.\\n\\n글이 삭제되었거나 이동된 경우입니다.', 'board/' . BO_TABLE); } // 로그인된 회원의 권한이 설정된 읽기 권한보다 작다면 if ($member['mb_level'] < $board['bo_read_level']) { if (IS_MEMBER) { alert('글을 읽을 권한이 없습니다.'); } else { alert('글을 읽을 권한이 없습니다.\\n\\n회원이라면 로그인 후 이용하세요.', 'member/login/qry/' . url_encode('board/' . BO_TABLE . '/view' . $qstr)); } } // 자신의 글 and 관리자가 아니라면 비밀글 체크 if (!(IS_MEMBER && $write['mb_id'] && $write['mb_id'] == $member['mb_id']) && !IS_ADMIN) { if (strpos($write['wr_option'], 'secret') !== FALSE) { $is_owner = FALSE; if ($write['wr_reply'] && IS_MEMBER) { // 자신의 비밀글의 답변이라면 통과 $row = $this->Board_model->is_owner(BO_TABLE, $write['wr_num']); if ($row['mb_id'] == $member['mb_id']) { $is_owner = TRUE; } } $ss_name = 'ss_secret_' . BO_TABLE . '_' . $write['wr_num']; if (!$is_owner) { // 한번 읽은 게시물의 번호는 세션에 저장되어 있고 같은 게시물을 읽을 경우는 다시 비밀번호를 묻지 않습니다. // 이 게시물이 저장된 게시물이 아니면서 관리자가 아니라면 if (!$this->session->userdata($ss_name)) { goto_url('board/' . BO_TABLE . '/password/w/s/wr_id/' . $wr_id . $dqstr); } } $this->session->set_userdata($ss_name, TRUE); } } // 한번 읽은글은 브라우저를 닫기전까지는 카운트를 증가시키지 않음 $ss_name = 'ss_view_' . BO_TABLE . '_' . $wr_id; if (!$this->session->userdata($ss_name)) { $this->Board_model->hit_update(BO_TABLE, $wr_id); $this->session->set_userdata($ss_name, TRUE); } } else { goto_url('board/' . BO_TABLE); } // IP 표시 $is_ip_view = $board['bo_use_ip_view']; if (IS_ADMIN) { $is_ip_view = TRUE; $ip = $write['wr_ip']; } else { // 관리자가 아니라면 IP 주소를 감춘후 보여줍니다. $ip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", "\\1.♡.\\3.\\4", $write['wr_ip']); } if ($stx) { $stx = get_text($stx); } // 최고, 그룹관리자라면 글 복사, 이동 버튼 $btn_admin = ''; if ($write['wr_reply'] == '' && (IS_ADMIN == 'super' || IS_ADMIN == 'group')) { $start = "post_win('mvcp', '_board/movecopy', {'is_admin':'" . IS_ADMIN . "','bo_table':'" . BO_TABLE . "','wr_id':'" . $wr_id . "','sw':'"; $end = "'}, 'left=50, top=50, width=500, height=550, scrollbars=1');"; $btn_admin = '<span class="btn-group">'; $btn_admin .= "<button type='button' class='btn btn-default' onclick=\"" . $start . "copy" . $end . "\">복사</button>"; $btn_admin .= "<button type='button' class='btn btn-default' onclick=\"" . $start . "move" . $end . "\">이동</button>"; $btn_admin .= '</span> '; } // 목록 버튼 $btn_list = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/lists" . $dqstr . "' class='btn btn-warning'>목록</a>"; // 글쓰기 & 답변 버튼 $btn_write = $btn_reply = ''; if ($board['bo_use_private'] && !IS_ADMIN) { $btn_write = $btn_reply = FALSE; } else { if ($member['mb_level'] >= $board['bo_write_level']) { $btn_write = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/write" . ($sca ? '?sca=' . $sca : '') . "' class='btn btn-primary'><span class='glyphicon glyphicon-pencil'></span> 글쓰기</a>"; } if ($member['mb_level'] >= $board['bo_reply_level']) { $btn_reply = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/write/w/r" . $qstr . "' class='btn btn-info'>답변</a>"; } } // 수정 & 삭제 버튼 $btn_update = $btn_delete = ''; // 로그인중이고 자신의 글이라면 또는 관리자라면 비밀번호를 묻지 않고 바로 수정, 삭제 가능 if (IS_MEMBER && $member['mb_id'] == $write['mb_id'] || IS_ADMIN) { $btn_update = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/write/w/u" . $qstr . "' class='btn btn-info'>수정</a>"; $btn_delete = "<button type='button' class='btn btn-danger' onclick=\"javascript:post_send('_trans/board_write/delete', {bo_table:'" . BO_TABLE . "', wr_id:'" . $wr_id . "', is_admin:'" . IS_ADMIN . "', qstr:'" . $dqstr . "'}, true);\">삭제</button>"; } else { if (!$write['mb_id']) { // 회원이 쓴 글이 아니라면 $btn_update = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/password/w/u" . $qstr . "' class='btn btn-info'>수정</a>"; $btn_delete = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/password/w/d" . $qstr . "' class='btn btn-danger'>삭제</a>"; } } $btn_prev = $btn_next = ''; if (!$board['bo_use_list_view']) { $pn = $this->Board_model->prev_next_link(BO_TABLE, $write['wr_num'], $write['wr_reply'], $sca, $sfl, $stx); // 이전글 링크 $prev = $pn['prev']; if ($prev['wr_id']) { $prev_wr_subject = cut_str(get_text($prev['wr_subject']), 255); $btn_prev = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/view" . $seg->replace('wr_id', $prev['wr_id']) . "' title='" . $prev_wr_subject . "'>← 이전글</a>"; } // 다음글 링크 $next = $pn['next']; if ($next['wr_id']) { $next_wr_subject = cut_str(get_text($next['wr_subject']), 255); $btn_next = "<a href='" . RT_PATH . "/board/" . BO_TABLE . "/view" . $seg->replace('wr_id', $next['wr_id']) . "' title='" . $next_wr_subject . "'>다음글 →</a>"; } } // 버튼s $link_btns = $btn_admin . '<span class="btn-group">' . $btn_list . $btn_update . $btn_delete . $btn_reply . $btn_write . '</span>'; // 전체목록보이기 $list_view = FALSE; if ($member['mb_level'] >= $board['bo_list_level'] && $board['bo_use_list_view']) { $list_view = TRUE; } // 사이드 뷰 if ($board['bo_use_sideview']) { $this->load->helper('sideview'); } // 가공 $view = get_convert($write, $board, 255, $qstr); if (strpos($sfl, 'subject')) { $view['subject'] = search_font($view['subject'], $stx); } // 이미지 리사이즈 if ($write['wr_count_image'] > 0) { define('RESIZE_WIDTH', $board['bo_image_width']); $this->load->helper('resize'); $view['wr_content'] = resize_content($view['wr_content']); } $is_editor = strpos($view['wr_option'], 'editor') !== FALSE ? TRUE : FALSE; $view['content'] = conv_content($view['wr_content'], $is_editor); if (strpos($sfl, 'content')) { $view['content'] = search_font($view['content'], $stx); } // SyntaxHighlighter $is_syntax = FALSE; if ($board['bo_use_syntax'] && $is_editor) { $this->load->config('cf_syntax'); $brush_js = $this->config->item('brush_js'); preg_match_all("/brush: (" . implode('|', array_keys($brush_js)) . ")/i", $view['content'], $match); $match = array_unique($match[1]); if ($match) { $is_syntax = TRUE; // 있을 때 $view['content'] = preg_replace_callback('/(<pre class="brush:[^>]+>)([\\s\\S]+?)(<\\/pre>)/i', create_function('$content', 'return $content[1] .str_ireplace("<br>", "\\n",strip_tags(str_ireplace("</p>", "<br>", $content[2]), "<br>")) .$content[3];'), $view['content']); $js[] = 'syntax/shCore'; foreach ($match as $brush) { $js[] = 'syntax/' . $brush_js[$brush]; } } } // 댓글 출력 여부 $is_comment = FALSE; if ($board['bo_use_comment'] && strpos($write['wr_option'], 'nocomt') === FALSE) { $is_comment = TRUE; } $head = array('title' => $board['gr_subject'] . ' > ' . $board['bo_subject'] . ' > ' . strip_tags($view['subject']), 'sca' => $sca); $data = array('subject' => $view['subject'], 'content' => $view['content'], 'name' => $view['name'], 'ip' => $is_ip_view ? '(' . $ip . ')' : '', 'datetime' => date('y-m-d H:i', strtotime($view['wr_datetime'])), 'hit' => number_format($view['wr_hit']), 'btn_prev' => $btn_prev, 'btn_next' => $btn_next, 'link_btns' => $link_btns, 'btn_sns' => $board['bo_use_sns'] ? sns_post(BO_TABLE, $wr_id, $view['subject'], $view['content']) : '', 'is_comment' => $is_comment, 'is_syntax' => $is_syntax, 'wr_id' => $wr_id, 'qstr' => $qstr); // JavaScript Load if ($board['bo_use_sideview']) { $js[] = 'sideview'; } if (!IS_MEMBER && $is_comment) { $js[] = 'md5'; $js[] = 'kcaptcha'; } // Extra if ($board['bo_use_extra']) { $data = array_merge($data, $this->Board_model->get_extra(BO_TABLE, $wr_id)); } widget::run('head', $head); $this->load->view('board/' . $board['bo_skin'] . '/view', $data); if ($list_view) { if (IS_ADMIN) { $js[] = 'board_check'; } if ($board['bo_use_category']) { $js[] = 'category'; } widget::run('_board/lists', TRUE); } widget::run('tail', array('js' => $js)); }