Exemplo n.º 1
0
 public function point_ranking_month($year = 0, $month = 0, $limit = 0)
 {
     $year = (int) $year;
     if ($year < 1000 or $year > 2999) {
         $year = cdate('Y');
     }
     $month = (int) $month;
     if ($month < 1 or $month > 12) {
         $month = (int) cdate('m');
     }
     $month = sprintf("%02d", $month);
     $start_datetime = $year . '-' . $month . '-01 00:00:00';
     $end_datetime = $year . '-' . $month . '-31 23:59:59';
     if (empty($limit)) {
         $limit = 100;
     }
     $this->db->select_sum('poi_point');
     $this->db->select('member.mem_id, member.mem_userid, member.mem_nickname, member.mem_is_admin, member.mem_icon');
     $this->db->join('member', 'point.mem_id = member.mem_id', 'inner');
     $this->db->where('member.mem_denied', 0);
     $this->db->where('member.mem_is_admin', 0);
     $this->db->where('point.poi_datetime >=', $start_datetime);
     $this->db->where('point.poi_datetime <=', $end_datetime);
     $this->db->where('poi_point >', 0);
     $this->db->group_by('member.mem_id');
     $this->db->order_by('poi_point', 'DESC');
     $this->db->limit($limit);
     $qry = $this->db->get('point');
     $result = $qry->result_array();
     return $result;
 }
Exemplo n.º 2
0
 public function add_visit_date()
 {
     $sql = 'INSERT INTO ' . $this->db->dbprefix($this->_table);
     $sql .= " (scd_date, scd_count) VALUES ('" . cdate('Y-m-d') . "', 1) ";
     $sql .= " ON DUPLICATE KEY UPDATE scd_count= scd_count + 1 ";
     return $this->db->query($sql);
 }
Exemplo n.º 3
0
 public function add_visit_board($brd_id = 0)
 {
     $brd_id = (int) $brd_id;
     if (empty($brd_id) or $brd_id < 1) {
         return false;
     }
     $sql = 'INSERT INTO ' . $this->db->dbprefix($this->_table);
     $sql .= " (scb_date, brd_id, scb_count) VALUES ('" . cdate('Y-m-d') . "', '" . $brd_id . "', 1) ";
     $sql .= " ON DUPLICATE KEY UPDATE scb_count= scb_count + 1 ";
     return $this->db->query($sql);
 }
Exemplo n.º 4
0
 public function get_current_count($curdatetime = '')
 {
     if (empty($curdatetime)) {
         $curdatetime = cdate('Y-m-d H:i:s', ctimestamp() - 600);
     }
     $this->db->select('count(*) as rownum');
     $this->db->join('member', 'currentvisitor.mem_id = member.mem_id', 'left');
     $this->db->where(array('cur_datetime >' => $curdatetime));
     $this->db->group_start();
     $this->db->where(array('member.mem_is_admin' => 0));
     $this->db->or_where(array('member.mem_is_admin' => null));
     $this->db->group_end();
     $qry = $this->db->get($this->_table);
     $rows = $qry->row_array();
     return $rows['rownum'];
 }
Exemplo n.º 5
0
 public function get_id($ip)
 {
     $this->db->query('LOCK TABLE ' . $this->db->dbprefix . $this->_table . ' WRITE');
     while (true) {
         $key = cdate('YmdHis') . str_pad((int) (microtime() * 100), 2, "0", STR_PAD_LEFT);
         $insertdata = array('unq_id' => $key, 'unq_ip' => $ip);
         $result = $this->db->insert($this->_table, $insertdata);
         if ($result) {
             break;
             // 쿼리가 정상이면 빠진다.
         }
         usleep(10000);
         // 100분의 1초를 쉰다
     }
     $this->db->query('UNLOCK TABLES');
     return $key;
 }
Exemplo n.º 6
0
 /**
  * 포인트를 추가합니다
  */
 public function insert_point($mem_id = 0, $point = 0, $content = '', $poi_type = '', $poi_related_id = '', $poi_action = '')
 {
     // 포인트 사용을 하지 않는다면 return
     if (!$this->CI->cbconfig->item('use_point')) {
         return false;
     }
     // 포인트가 없다면 업데이트 할 필요 없음
     $point = (int) $point;
     if (empty($point)) {
         return false;
     }
     // 회원아이디가 없다면 업데이트 할 필요 없음
     $mem_id = (int) $mem_id;
     if (empty($mem_id) or $mem_id < 1) {
         return false;
     }
     if (empty($content)) {
         return false;
     }
     if (empty($poi_type) && empty($poi_related_id) && empty($poi_action)) {
         return false;
     }
     $member = $this->CI->Member_model->get_by_memid($mem_id, 'mem_id');
     if (!element('mem_id', $member)) {
         return false;
     }
     $this->CI->load->model('Point_model');
     // 이미 등록된 내역이라면 건너뜀
     if ($poi_type or $poi_related_id or $poi_action) {
         $where = array('mem_id' => $mem_id, 'poi_type' => $poi_type, 'poi_related_id' => $poi_related_id, 'poi_action' => $poi_action);
         $cnt = $this->CI->Point_model->count_by($where);
         if ($cnt > 0) {
             return false;
         }
     }
     $insertdata = array('mem_id' => $mem_id, 'poi_datetime' => cdate('Y-m-d H:i:s'), 'poi_content' => $content, 'poi_point' => $point, 'poi_type' => $poi_type, 'poi_related_id' => $poi_related_id, 'poi_action' => $poi_action);
     $this->CI->Point_model->insert($insertdata);
     $sum = $this->CI->Point_model->get_point_sum($mem_id);
     $updatedata = array('mem_point' => $sum);
     $this->CI->Member_model->update($mem_id, $updatedata);
     return $sum;
 }
Exemplo n.º 7
0
function listGuests($rGuests, $noMsg)
{
    global $showIPs;
    if (!NumRows($rGuests)) {
        return "<tr class=\"cell0\"><td colspan=\"6\">{$noMsg}</td></tr>";
    }
    $i = 1;
    while ($guest = Fetch($rGuests)) {
        $cellClass = ($cellClass + 1) % 2;
        if ($guest['date']) {
            $lastUrl = "<a href=\"" . FilterURL($guest['lasturl']) . "\">" . FilterURL($guest['lasturl']) . "</a>";
        } else {
            $lastUrl = __("None");
        }
        $guestList .= "\n\t\t<tr class=\"cell{$cellClass}\">\n\t\t\t<td>{$i}</td>\n\t\t\t<td colspan=\"2\" title=\"" . htmlspecialchars($guest['useragent']) . "\">" . htmlspecialchars(substr($guest['useragent'], 0, 65)) . "</td>\n\t\t\t<td>" . cdate("d-m-y G:i:s", $guest['date']) . "</td>\n\t\t\t<td>{$lastUrl}</td>";
        if ($showIPs) {
            $guestList .= "<td>" . formatIP($guest['ip']) . "</td>";
        }
        $guestList .= "</tr>";
        $i++;
    }
    return $guestList;
}
Exemplo n.º 8
0
 public function get_banner($position = '', $type = '', $limit = '')
 {
     if (empty($position)) {
         return;
     }
     if (strtolower($type) !== 'order') {
         $type = 'random';
     }
     $cachename = 'banner-' . $position . '-' . cdate('Y-m-d');
     if (!($result = $this->cache->get($cachename))) {
         $this->db->from($this->_table);
         $this->db->where('bng_name', $position);
         $this->db->where('ban_activated', 1);
         $this->db->group_start();
         $this->db->where(array('ban_start_date <=' => cdate('Y-m-d')));
         $this->db->or_where(array('ban_start_date' => null));
         $this->db->group_end();
         $this->db->group_start();
         $this->db->where('ban_end_date >=', cdate('Y-m-d'));
         $this->db->or_where('ban_end_date', '0000-00-00');
         $this->db->or_where(array('ban_end_date' => ''));
         $this->db->or_where(array('ban_end_date' => null));
         $this->db->group_end();
         $this->db->order_by('ban_order', 'DESC');
         $res = $this->db->get();
         $result = $res->result_array();
         $this->cache->save($cachename, $result, $this->cache_time);
     }
     if ($type === 'random') {
         shuffle($result);
     }
     if ($limit) {
         $result = array_slice($result, 0, $limit);
     }
     return $result;
 }
Exemplo n.º 9
0
function listGuests($rGuests)
{
    global $showIPs;
    $guestList = array();
    $i = 1;
    while ($guest = Fetch($rGuests)) {
        $gdata = array();
        $gdata['num'] = $i++;
        if ($showIPs) {
            $gdata['userAgent'] = '<span title="' . htmlspecialchars($guest['useragent']) . '">' . htmlspecialchars(substr($guest['useragent'], 0, 65)) . '</span>';
        }
        $gdata['lastView'] = cdate("d-m-y G:i:s", $guest['date']);
        if ($guest['date']) {
            $gdata['lastURL'] = "<a href=\"" . FilterURL($guest['lasturl']) . "\">" . FilterURL($guest['lasturl']) . "</a>";
        } else {
            $gdata['lastURL'] = __("None");
        }
        if ($showIPs) {
            $gdata['ip'] = formatIP($guest['ip']);
        }
        $guestList[] = $gdata;
    }
    return $guestList;
}
Exemplo n.º 10
0
            for ($i = 1; $i < $n; $i++) {
                $pl .= " <a href=\"thread.php?id=" . $thread['id'] . "&amp;from=" . $i * $ppp . "\">" . ($i + 1) . "</a>";
            }
            $pl .= " &hellip; ";
            for ($i = $numpages - $n + 1; $i <= $numpages; $i++) {
                $pl .= " <a href=\"thread.php?id=" . $thread['id'] . "&amp;from=" . $i * $ppp . "\">" . ($i + 1) . "</a>";
            }
        }
        if ($pl) {
            $pl = " <span class=\"smallFonts\">[<a href=\"thread.php?id=" . $thread['id'] . "\">1</a>" . $pl . "]</span>";
        }
        $lastLink = "";
        if ($thread['lastpostid']) {
            $lastLink = " <a href=\"thread.php?pid=" . $thread['lastpostid'] . "#" . $thread['lastpostid'] . "\">&raquo;</a>";
        }
        $forumList .= Format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td class=\"cell2 threadIcon\">{1}</td>\n\t\t\t<td class=\"threadIcon\" style=\"border-right: 0px none;\">\n\t\t\t\t{2}\n\t\t\t</td>\n\t\t\t<td style=\"border-left: 0px none;\">\n\t\t\t\t{3}\n\t\t\t\t<a href=\"thread.php?id={4}\">\n\t\t\t\t\t{5}\n\t\t\t\t</a>\n\t\t\t\t{6}\n\t\t\t\t{7}\n\t\t\t</td>\n\t\t\t<td class=\"center\">\n\t\t\t\t{8}\n\t\t\t</td>\n\t\t\t<td class=\"center\">\n\t\t\t\t{9}\n\t\t\t</td>\n\t\t\t<td class=\"center\">\n\t\t\t\t{10}\n\t\t\t</td>\n\t\t\t<td class=\"smallFonts center\">\n\t\t\t\t{11}<br />\n\t\t\t\t" . __("by") . " {12} {13}</td>\n\t\t</tr>\n", $cellClass, $NewIcon, $ThreadIcon, $poll, $thread['id'], strip_tags($thread['title']), $pl, $tags, UserLink($starter), $thread['replies'], $thread['views'], cdate($dateformat, $thread['lastpostdate']), UserLink($last), $lastLink);
    }
    Write("\n\t<table class=\"outline margin width100\">\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 20px;\">&nbsp;</th>\n\t\t\t<th style=\"width: 16px;\">&nbsp;</th>\n\t\t\t<th style=\"width: 60%;\">" . __("Title") . "</th>\n\t\t\t<th>" . __("Started by") . "</th>\n\t\t\t<th>" . __("Replies") . "</th>\n\t\t\t<th>" . __("Views") . "</th>\n\t\t\t<th>" . __("Last post") . "</th>\n\t\t</tr>\n\t\t{0}\n\t</table>\n", $forumList);
} else {
    if ($forum['minpowerthread'] > $loguser['powerlevel']) {
        Alert(__("You cannot start any threads here."), __("Empty forum"));
    } elseif ($loguserid) {
        Alert(format(__("Would you like to {0}post something{1}?"), "<a href=\"newthread.php?id=" . $fid . "\">", "</a>"), __("Empty forum"));
    } else {
        Alert(format(__("{0}Log in{1} so you can post something."), "<a href=\"login.php\">", "</a>"), __("Empty forum"));
    }
}
if ($pagelinks) {
    Write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
}
MakeCrumbs(array(__("Main") => "./", $forum['title'] => "forum.php?id=" . $fid), $links);
Exemplo n.º 11
0
}
if (IsAllowed("viewOnline")) {
    print "<li><a href=\"online.php\">" . __("Online users") . "</a></li>";
}
if (IsAllowed("search")) {
    print "<li><a href=\"search.php\">" . __("Search") . "</a></li>";
}
print "<li><a href=\"lastposts.php\">" . __("Last posts") . "</a></li>";
$bucket = "topMenu";
include "./lib/pluginloader.php";
?>
					</ul>
				</td>
				<td rowspan="2" class="smallFonts" style="text-align: center; width: 10%;">
					<?php 
print cdate($dateformat) . "\n";
?>
				</td>
			</tr>
			<tr class="cell2">
				<td class="smallFonts" style="text-align: center">
					<?php 
if ($loguserid) {
    print UserLink($loguser) . ": ";
    print "<ul class=\"pipemenu\">";
    print "<li><a href=\"#\" onclick=\"if(confirm('" . __("Are you sure you want to log out?") . "')) document.forms[0].submit();\">" . __("Log out") . "</a></li>";
    if (IsAllowed("editProfile")) {
        print "<li><a href=\"editprofile.php\">" . __("Edit profile") . "</a></li>";
    }
    if (IsAllowed("viewPM")) {
        print "<li><a href=\"private.php\">" . __("Private messages") . "</a></li>";
Exemplo n.º 12
0
/**
 * Given some details, generate a printable packing slip.
 *
 * @param string $title Title of the packing slip.
 * @param array $details Array of details about the packing slip.
 * @param array $products Array of products for the packing slip.
 * @return string Generated HTML packing slip.
 */
function generatePrintablePackingSlip($title, $details, $products)
{
	$db = $GLOBALS['ISC_CLASS_DB'];

	$template = new TEMPLATE('ISC_LANG');
	$template->frontEnd();
	$template->setTemplateBase(ISC_BASE_PATH . "/templates");
	$template->panelPHPDir = ISC_BASE_PATH . "/includes/display/";
	$template->templateExt = "html";
	$template->setTemplate(getConfig("template"));

	$template->assign('PackingSlipTitle', $title);
	$template->assign('OrderId', $details['shiporderid']);
	$template->assign('OrderDate', cdate($details['shiporderdate']));

	if(!empty($details['shipmethod'])) {
		$template->assign('ShippingMethod', isc_html_escape($details['shipmethod']));
	}
	else {
		$template->assign('HideShippingMethod', 'display: none');
	}

	if(!empty($details['shiptrackno'])) {
		$template->assign('TrackingNo', isc_html_escape($details['shiptrackno']));
	}
	else {
		$template->assign('HideTrackingNo', 'display: none');
	}

	if(!empty($details['shipcomments'])) {
		$template->assign('Comments', nl2br(isc_html_escape($details['shipcomments'])));
		$template->assign('HideComments', '');
	}
	else {
		$template->assign('Comments', '');
		$template->assign('HideComments', 'display: none');
	}

	if(!empty($details['shipdate'])) {
		$template->assign('DateShipped', cDate($details['shipdate']));
	}
	else {
		$template->assign('HideShippingDate', 'display: none');
	}

	if(empty($products)) {
		return false;
	}

	$query = "
		SELECT customerid, CONCAT(custconfirstname, ' ', custconlastname) AS ordcustname, custconemail AS ordcustemail, custconphone AS ordcustphone
		FROM [|PREFIX|]customers
		WHERE customerid = '".$db->Quote($details['shipcustid'])."'
	";
	$query .= $db->AddLimit(0, 1);
	$result = $db->Query($query);

	$template->assign('CustomerName', '');
	$template->assign('CustomerEmail', '');
	$template->assign('CustomerPhone', '');

	if($customer = $db->Fetch($result)) {
		// Format the customer details
		$template->assign('CustomerName', isc_html_escape($customer['ordcustname']));
		$template->assign('CustomerEmail', isc_html_escape($customer['ordcustemail']));
		$template->assign('CuastomerPhone', isc_html_escape($customer['ordcustphone']));
		$template->assign('CustomerId', $customer['customerid']);
	}
	else {
		$template->assign('HideCustomerDetails', 'display: none');
	}

	$template->assign('StoreAddressFormatted', nl2br(GetConfig('StoreAddress')));

	$addressDetails = array(
		'shipfirstname'	=> $details['shipbillfirstname'],
		'shiplastname'	=> $details['shipbilllastname'],
		'shipcompany'	=> $details['shipbillcompany'],
		'shipaddress1'	=> $details['shipbillstreet1'],
		'shipaddress2'	=> $details['shipbillstreet2'],
		'shipcity'		=> $details['shipbillsuburb'],
		'shipstate'		=> $details['shipbillstate'],
		'shipzip'		=> $details['shipbillzip'],
		'shipcountry'	=> $details['shipbillcountry'],
		'countrycode'	=> $details['shipbillcountrycode'],
	);
	$template->assign('BillingAddress', ISC_ADMIN_ORDERS::buildOrderAddressDetails($addressDetails, false));
	$template->assign('BillingPhone', isc_html_escape($details['shipbillphone']));
	if(!$details['shipbillphone']) {
		$template->assign('HideBillingPhone', 'display: none');
	}
	$template->assign('BillingEmail', isc_html_escape($details['shipbillemail']));
	if(!$details['shipbillemail']) {
		$template->assign('HideBillingEmail', 'display: none');
	}

	$addressDetails = array(
		'shipfirstname'	=> $details['shipshipfirstname'],
		'shiplastname'	=> $details['shipshiplastname'],
		'shipcompany'	=> $details['shipshipcompany'],
		'shipaddress1'	=> $details['shipshipstreet1'],
		'shipaddress2'	=> $details['shipshipstreet2'],
		'shipcity'		=> $details['shipshipsuburb'],
		'shipstate'		=> $details['shipshipstate'],
		'shipzip'		=> $details['shipshipzip'],
		'shipcountry'	=> $details['shipshipcountry'],
		'countrycode'	=> $details['shipshipcountrycode'],
	);
	$template->assign('ShippingAddress', ISC_ADMIN_ORDERS::buildOrderAddressDetails($addressDetails, false));
	$template->assign('ShippingPhone', isc_html_escape($details['shipshipphone']));
	if(!$details['shipshipphone']) {
		$template->assign('HideShippingPhone', 'display: none');
	}
	$template->assign('ShippingEmail', isc_html_escape($details['shipshipemail']));
	if(!$details['shipshipemail']) {
		$template->assign('HideShippingEmail', 'display: none');
	}

	$fieldsArray = array();
	$query = "
		SELECT o.*
		FROM [|PREFIX|]order_configurable_fields o
		JOIN [|PREFIX|]product_configurable_fields p ON o.fieldid = p.productfieldid
		WHERE o.orderid=".(int)$details['shiporderid']."
		ORDER BY p.fieldsortorder ASC
	";
	$result = $db->Query($query);
	$fields = array();
	while ($row = $db->Fetch($result)) {
		$fieldsArray[$row['ordprodid']][] = $row;
	}

	// Build the list of products that are being shipped
	$productsTable = '';
	foreach($products as $product) {
		$template->assign('ProductName', isc_html_escape($product['prodname']));
		if($product['prodcode']) {
			$template->assign('ProductSku', isc_html_escape($product['prodcode']));
		}
		else {
			$template->assign('ProductSku', getLang('NA'));
		}
		$template->assign('ProductQuantity', $product['prodqty']);

		$pOptions = '';
		if($product['prodoptions'] != '') {
			$options = @unserialize($product['prodoptions']);
			if(!empty($options)) {
				foreach($options as $name => $value) {
					$template->assign('FieldName', isc_html_escape($name));
					$template->assign('FieldValue', isc_html_escape($value));
					$pOptions .= $template->GetSnippet('PrintableInvoiceItemConfigurableField');
				}
			}
		}

		if($pOptions) {
			$template->assign('ProductOptions', $pOptions);
			$template->assign('HideVariationOptions', '');
		}
		else {
			$template->assign('HideVariationOptions', 'display: none');
		}

		$productFields = '';
		if(!empty($fieldsArray[$product['prodordprodid']])) {
			$fields = $fieldsArray[$product['prodordprodid']];
			foreach($fields as $field) {
				if(empty($field['textcontents']) && empty($field['filename'])) {
					continue;
				}

				$fieldValue = '-';
				$template->assign('FieldName', isc_html_escape($field['fieldname']));

				if($field['fieldtype'] == 'file') {
					$fieldValue = '<a href="'.GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/configured_products/'.urlencode($field['originalfilename']).'">'.isc_html_escape($field['originalfilename']).'</a>';
				}
				else {
					$fieldValue = isc_html_escape($field['textcontents']);
				}

				$template->assign('FieldValue', $fieldValue);
				$productFields .= $template->getSnippet('PrintableInvoiceItemConfigurableField');
			}
		}
		$template->assign('ProductConfigurableFields', $productFields);
		if(!$productFields) {
			$template->assign('HideConfigurableFields', 'display: none');
		}
		else {
			$template->assign('HideConfigurableFields', '');
		}

		if($product['prodeventdatename']) {
			$template->assign('FieldName', isc_html_escape($product['prodeventdatename']));
			$template->assign('FieldValue', isc_date('dS M Y', $product['prodeventdate']));
			$template->assign('ProductEventDate', $template->getSnippet('PrintableInvoiceItemConfigurableField'));
			$template->assign('HideEventDate', '');
		}
		else {
			$template->assign('ProductEventDate', '');
			$template->assign('HideEventDate', 'display: none');
		}

		$productsTable .= $template->GetSnippet('PrintablePackingSlipItem');
	}
	$template->assign('ProductsTable', $productsTable);
	$template->setTemplate('packing_slip_print');
	return $template->parseTemplate(true);
}
Exemplo n.º 13
0
    write("\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Sort by") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t<ul class=\"pipemenu\">\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{1}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{2}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{3}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{4}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{5}\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Order") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t<ul class=\"pipemenu\">\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{6}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{7}\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Sex") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t<ul class=\"pipemenu\">\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{8}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{9}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{10}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{11}\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Power") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t<ul class=\"pipemenu\">\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{12}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{13}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{14}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{15}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{16}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{17}\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{18}\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Name") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t<ul class=\"pipemenu\">\n\t\t\t\t\t{19}\n\t\t\t\t</ul>\n\t\t\t</td>\n\t\t</tr>\n", null, mlink("", $sex, $pow, $tpp, $letter, $dir) . __("Posts") . "</a>", mlink("id", $sex, $pow, $tpp, $letter) . __("ID") . "</a>", mlink("name", $sex, $pow, $tpp, $letter, $dir) . __("Username") . "</a>", mlink("karma", $sex, $pow, $tpp, $letter, $dir) . __("Karma") . "</a>", mlink("reg", $sex, $pow, $tpp, $letter, $dir) . __("Registration date") . "</a>", mlink($sort, $sex, $pow, $tpp, $letter, "asc") . __("Ascending") . "</a>", mlink($sort, $sex, $pow, $tpp, $letter, "desc") . __("Descending") . "</a>", mlink($sort, "m", $pow, $tpp, $letter, $dir) . __("Male") . "</a>", mlink($sort, "f", $pow, $tpp, $letter, $dir) . __("Female") . "</a>", mlink($sort, "n", $pow, $tpp, $letter, $dir) . __("N/A") . "</a>", mlink($sort, "", $pow, $tpp, $letter, $dir) . __("All") . "</a>", mlink($sort, $sex, "-1", $tpp, $letter, $dir) . __("Banned") . "</a>", mlink($sort, $sex, "0", $tpp, $letter, $dir) . __("Normal") . "</a>", mlink($sort, $sex, "1", $tpp, $letter, $dir) . __("Local moderator") . "</a>", mlink($sort, $sex, "2", $tpp, $letter, $dir) . __("Full moderator") . "</a>", mlink($sort, $sex, "3", $tpp, $letter, $dir) . __("Administrator") . "</a>", mlink($sort, $sex, "4", $tpp, $letter, $dir) . __("Root") . "</a>", mlink($sort, $sex, "", $tpp, $letter, $dir) . __("All") . "</a>", $alphabet);
}
if ($pagelinks) {
    write("\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Page") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t{0}\n\t\t\t</td>\n\t\t</tr>\n", $pagelinks);
}
$memberList = "";
if ($numUsers) {
    while ($user = Fetch($rUsers)) {
        $bucket = "userMangler";
        include "./lib/pluginloader.php";
        $daysKnown = (time() - $user['regdate']) / 86400;
        $user['average'] = sprintf("%1.02f", $user['posts'] / $daysKnown);
        $userPic = "";
        if ($user['picture'] && $hacks['themenames'] != 3) {
            $userPic = "<img src=\"" . str_replace("img/avatars/", "img/avatars/", $user['picture']) . "\" alt=\"\" style=\"width: 60px;\" />";
        }
        $cellClass = ($cellClass + 1) % 2;
        $memberList .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>{1}</td>\n\t\t\t<td>{2}</td>\n\t\t\t<td>{3}</td>\n\t\t\t<td>{4}</td>\n\t\t\t<td>{5}</td>\n\t\t\t<td>{6}</td>\n\t\t\t<td>{7}</td>\n\t\t\t<td>{8}</td>\n\t\t</tr>\n", $cellClass, $user['id'], $userPic, UserLink($user), $user['posts'], $user['average'], $user['karma'], $user['birthday'] ? cdate("M jS", $user['birthday']) : "&nbsp;", cdate("M jS Y", $user['regdate']));
    }
} else {
    $memberList = format("\n\t\t<tr class=\"cell0\">\n\t\t\t<td colspan=\"8\">\n\t\t\t\t" . __("Nothing here.") . "\n\t\t\t</td>\n\t\t</tr>\n");
}
write("\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 30px; \">#</th>\n\t\t\t<th style=\"width: 62px; \">" . __("Picture") . "</th>\n\t\t\t<th>" . __("Name") . "</th>\n\t\t\t<th style=\"width: 50px; \">" . __("Posts") . "</th>\n\t\t\t<th style=\"width: 50px; \">" . __("Average") . "</th>\n\t\t\t<th style=\"width: 50px; \">" . __("Karma") . "</th>\n\t\t\t<th style=\"width: 80px; \">" . __("Birthday") . "</th>\n\t\t\t<th style=\"width: 130px; \">" . __("Registered on") . "</th>\n\t\t</tr>\n\t\t{0}\n", $memberList);
if ($pagelinks) {
    write("\n\t\t<tr class=\"cell2 smallFonts\">\n\t\t\t<td colspan=\"2\">\n\t\t\t\t" . __("Page") . "\n\t\t\t</td>\n\t\t\t<td colspan=\"6\">\n\t\t\t\t{0}\n\t\t\t</td>\n\t\t</tr>\n", $pagelinks);
}
write("\n\t</table>\n");
function mlink($sort, $sex, $pow, $tpp, $letter = "", $dir = "", $from = 1)
{
    return "<a href=\"memberlist.php?" . ($sort ? "sort={$sort}" : "") . ($sex ? "&amp;sex={$sex}" : "") . (isset($pow) ? "&amp;pow={$pow}" : "") . ($letter != "" ? "&amp;letter={$letter}" : "") . ($dir ? "&dir={$dir}" : "") . ($from != 1 ? "&amp;from={$from}" : "") . "\" rel=\"nofollow\">";
}
Exemplo n.º 14
0
CheckPermission('admin.ipsearch');
$ip = $_GET["id"];
if (!filter_var($ip, FILTER_VALIDATE_IP)) {
    Kill("Invalid IP");
}
$links = array();
$links[] = "<a href=\"http://dnsquery.org/ipwhois/{$ip}\" target=\"_blank\">Whois Query</a>";
$links[] = "<a onclick=\"if(confirm('Are you sure you want to IP-ban {$ip}?')) {document.getElementById('banform').submit();} return false;\" href=\"#\">IP Ban</a>";
MakeCrumbs(array(actionLink("admin") => __("Admin"), actionLink("ipbans") => __("IP ban manager"), '' => $ip), $links);
$rUsers = Query("select * from {users} where lastip={0}", $ip);
echo "<h3>Users with this IP</h3>";
$userList = "";
$ipBanComment = "";
$i = 1;
if (NumRows($rUsers)) {
    while ($user = Fetch($rUsers)) {
        $ipBanComment .= $user["name"] . " ";
        $cellClass = ($cellClass + 1) % 2;
        if ($user['lasturl']) {
            $lastUrl = "<a href=\"" . $user['lasturl'] . "\">" . $user['lasturl'] . "</a>";
        } else {
            $lastUrl = __("None");
        }
        $userList .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{2}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{3}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{4}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{6}\n\t\t\t</td>\n\t\t</tr>\n\t", $cellClass, $i, UserLink($user), cdate("d-m-y G:i:s", $user['lastactivity']), $user['lastposttime'] ? cdate("d-m-y G:i:s", $user['lastposttime']) : __("Never"), $lastUrl, formatIP($user['lastip']));
        $i++;
    }
} else {
    $userList = "<tr class=\"cell0\"><td colspan=\"6\">" . __("No users") . "</td></tr>";
}
echo "<form id=\"banform\" action=\"" . htmlentities(actionLink('ipbans')) . "\" method=\"post\">\n\t<input type=\"hidden\" name=\"ip\" value=\"{$ip}\">\n\t<input type=\"hidden\" name=\"reason\" value=\"" . htmlentities($ipBanComment) . "\">\n\t<input type=\"hidden\" name=\"days\" value=\"0\">\n\t<input type=\"hidden\" name=\"actionadd\" value=\"yes, do it!\">\n</form>";
echo "\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 30px;\">\n\t\t\t\t#\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("Name") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("Last view") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("Last post") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("URL") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("IP") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t{$userList}\n\t</table>";
Exemplo n.º 15
0
function formatdatenow()
{
    return cdate(getdateformat());
}
Exemplo n.º 16
0
 /**
  * 게시판 글쓰기 또는 수정 페이지를 가져오는 메소드입니다
  */
 public function write($pid = 0)
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_admin_page_faq_write';
     $this->load->event($eventname);
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     /**
      * 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
      */
     if ($pid) {
         $pid = (int) $pid;
         if (empty($pid) or $pid < 1) {
             show_404();
         }
     }
     $fgr_id = (int) $this->input->get('fgr_id');
     if (empty($fgr_id) or $fgr_id < 1) {
         show_404();
     }
     $primary_key = $this->{$this->modelname}->primary_key;
     /**
      * 수정 페이지일 경우 기존 데이터를 가져옵니다
      */
     if ($pid) {
         $getdata = $this->{$this->modelname}->get_one($pid);
     }
     /**
      * Validation 라이브러리를 가져옵니다
      */
     $this->load->library('form_validation');
     /**
      * 전송된 데이터의 유효성을 체크합니다
      */
     $config = array(array('field' => 'fgr_id', 'label' => 'FAQ그룹', 'rules' => 'trim|required|numeric'), array('field' => 'faq_order', 'label' => '정렬순서', 'rules' => 'trim|required|numeric'), array('field' => 'faq_title', 'label' => '질문', 'rules' => 'trim|required'), array('field' => 'faq_content', 'label' => '답변', 'rules' => 'trim|required'), array('field' => 'faq_mobile_content', 'label' => '모바일답변', 'rules' => 'trim'));
     $this->form_validation->set_rules($config);
     /**
      * 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
      * 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
      */
     if ($this->form_validation->run() === false) {
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
         if ($pid) {
             $view['view']['data'] = $getdata;
         }
         $view['view']['data']['faqgroup'] = $this->Faq_group_model->get_one($fgr_id);
         /**
          * primary key 정보를 저장합니다
          */
         $view['view']['primary_key'] = $primary_key;
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
         /**
          * 어드민 레이아웃을 정의합니다
          */
         $layoutconfig = array('layout' => 'layout', 'skin' => 'write');
         $view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
         $this->data = $view;
         $this->layout = element('layout_skin_file', element('layout', $view));
         $this->view = element('view_skin_file', element('layout', $view));
     } else {
         /**
          * 유효성 검사를 통과한 경우입니다.
          * 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
          */
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
         $content_type = $this->cbconfig->item('use_faq_dhtml') ? 1 : 0;
         $faq_order = $this->input->post('faq_order') ? $this->input->post('faq_order') : 0;
         $updatedata = array('fgr_id' => $this->input->post('fgr_id', null, 0), 'faq_title' => $this->input->post('faq_title', null, ''), 'faq_content' => $this->input->post('faq_content', null, ''), 'faq_mobile_content' => $this->input->post('faq_mobile_content', null, ''), 'faq_content_html_type' => $content_type, 'faq_order' => $faq_order);
         /**
          * 게시물을 수정하는 경우입니다
          */
         if ($this->input->post($primary_key)) {
             $this->{$this->modelname}->update($this->input->post($primary_key), $updatedata);
             $this->session->set_flashdata('message', '정상적으로 수정되었습니다');
         } else {
             /**
              * 게시물을 새로 입력하는 경우입니다
              */
             $updatedata['faq_datetime'] = cdate('Y-m-d H:i:s');
             $updatedata['faq_ip'] = $this->input->ip_address();
             $updatedata['mem_id'] = $this->member->item('mem_id');
             $this->{$this->modelname}->insert($updatedata);
             $this->session->set_flashdata('message', '정상적으로 입력되었습니다');
         }
         // 이벤트가 존재하면 실행합니다
         Events::trigger('after', $eventname);
         /**
          * 게시물의 신규입력 또는 수정작업이 끝난 후 목록 페이지로 이동합니다
          */
         $param =& $this->querystring;
         $redirecturl = admin_url($this->pagedir . '?' . $param->output());
         redirect($redirecturl);
     }
 }
Exemplo n.º 17
0
?>
";
var cb_cookie_domain = "<?php 
echo config_item('cookie_domain');
?>
";
var cb_charset = "<?php 
echo config_item('charset');
?>
";
var cb_time_ymd = "<?php 
echo cdate('Y-m-d');
?>
";
var cb_time_ymdhis = "<?php 
echo cdate('Y-m-d H:i:s');
?>
";
var layout_skin_path = "<?php 
echo element('layout_skin_path', $layout);
?>
";
var view_skin_path = "<?php 
echo element('view_skin_path', $layout);
?>
";
var is_member = "<?php 
echo $this->member->is_member() ? '1' : '';
?>
";
var is_admin = "<?php 
Exemplo n.º 18
0
 /**
  * 게시판 목록페이지입니다.
  */
 public function _get_list($brd_key, $from_view = '')
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_board_post_get_list';
     $this->load->event($eventname);
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     $return = array();
     $board = $this->_get_board($brd_key);
     $mem_id = (int) $this->member->item('mem_id');
     $alertmessage = $this->member->is_member() ? '회원님은 이 게시판 목록을 볼 수 있는 권한이 없습니다' : '비회원은 이 게시판에 접근할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오';
     $check = array('group_id' => element('bgr_id', $board), 'board_id' => element('brd_id', $board));
     $this->accesslevel->check(element('access_list', $board), element('access_list_level', $board), element('access_list_group', $board), $alertmessage, $check);
     if (element('use_personal', $board) && $this->member->is_member() === false) {
         alert('이 게시판은 1:1 게시판입니다. 비회원은 접근할 수 없습니다');
         return false;
     }
     $skindir = $this->cbconfig->get_device_view_type() === 'mobile' ? element('board_mobile_skin', $board) ? element('board_mobile_skin', $board) : element('board_skin', $board) : element('board_skin', $board);
     $skinurl = base_url(VIEW_DIR . 'board/' . $skindir);
     $view['view']['is_admin'] = $is_admin = $this->member->is_admin(array('board_id' => element('brd_id', $board), 'group_id' => element('bgr_id', $board)));
     /**
      * 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
      */
     $param =& $this->querystring;
     $page = (int) $this->input->get('page') > 0 ? (int) $this->input->get('page') : 1;
     $order_by_field = element('order_by_field', $board) ? element('order_by_field', $board) : 'post_num, post_reply';
     $findex = $this->input->get('findex', null, $order_by_field);
     $sfield = $sfieldchk = $this->input->get('sfield', null, '');
     if ($sfield === 'post_both') {
         $sfield = array('post_title', 'post_content');
     }
     $skeyword = $this->input->get('skeyword', null, '');
     if ($this->cbconfig->get_device_view_type() === 'mobile') {
         $per_page = element('mobile_list_count', $board) ? (int) element('mobile_list_count', $board) : 10;
     } else {
         $per_page = element('list_count', $board) ? (int) element('list_count', $board) : 20;
     }
     $offset = ($page - 1) * $per_page;
     $this->Post_model->allow_search_field = array('post_id', 'post_title', 'post_content', 'post_both', 'post_category', 'post_userid', 'post_nickname');
     // 검색이 가능한 필드
     $this->Post_model->search_field_equal = array('post_id', 'post_userid', 'post_nickname');
     // 검색중 like 가 아닌 = 검색을 하는 필드
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['step1'] = Events::trigger('step1', $eventname);
     /**
      * 상단에 공지사항 부분에 필요한 정보를 가져옵니다.
      */
     $except_all_notice = false;
     if (element('except_all_notice', $board) && $this->cbconfig->get_device_view_type() !== 'mobile') {
         $except_all_notice = true;
     }
     if (element('mobile_except_all_notice', $board) && $this->cbconfig->get_device_view_type() === 'mobile') {
         $except_all_notice = true;
     }
     $use_sideview = $this->cbconfig->get_device_view_type() === 'mobile' ? element('use_mobile_sideview', $board) : element('use_sideview', $board);
     $list_date_style = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_list_date_style', $board) : element('list_date_style', $board);
     $list_date_style_manual = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_list_date_style_manual', $board) : element('list_date_style_manual', $board);
     if (element('use_gallery_list', $board)) {
         $this->load->model('Post_file_model');
         $board['gallery_cols'] = $gallery_cols = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_gallery_cols', $board) : element('gallery_cols', $board);
         $board['gallery_image_width'] = $gallery_image_width = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_gallery_image_width', $board) : element('gallery_image_width', $board);
         $board['gallery_image_height'] = $gallery_image_height = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_gallery_image_height', $board) : element('gallery_image_height', $board);
         $board['gallery_percent'] = floor(102 / $board['gallery_cols']) - 2;
     }
     if (element('use_category', $board)) {
         $this->load->model('Board_category_model');
         $board['category'] = $this->Board_category_model->get_all_category(element('brd_id', $board));
     }
     $noticeresult = $this->Post_model->get_notice_list(element('brd_id', $board), $except_all_notice, $sfield, $skeyword);
     if ($noticeresult) {
         foreach ($noticeresult as $key => $val) {
             $notice_brd_key = $this->board->item_id('brd_key', element('brd_id', $val));
             $noticeresult[$key]['post_url'] = post_url($notice_brd_key, element('post_id', $val));
             $noticeresult[$key]['meta'] = $meta = $this->Post_meta_model->get_all_meta(element('post_id', $val));
             if ($this->cbconfig->get_device_view_type() === 'mobile') {
                 $noticeresult[$key]['title'] = element('mobile_subject_length', $board) ? cut_str(element('post_title', $val), element('mobile_subject_length', $board)) : element('post_title', $val);
             } else {
                 $noticeresult[$key]['title'] = element('subject_length', $board) ? cut_str(element('post_title', $val), element('subject_length', $board)) : element('post_title', $val);
             }
             if (element('post_del', $val)) {
                 $noticeresult[$key]['title'] = '게시물이 삭제 되었습니다';
             }
             $noticeresult[$key]['display_name'] = display_username(element('post_userid', $val), element('post_nickname', $val), element('mem_icon', $val), $use_sideview ? 'Y' : 'N');
             $noticeresult[$key]['display_datetime'] = display_datetime(element('post_datetime', $val), $list_date_style, $list_date_style_manual);
             $noticeresult[$key]['category'] = '';
             if (element('use_category', $board) && element('post_category', $val)) {
                 $noticeresult[$key]['category'] = $this->Board_category_model->get_category_info(element('brd_id', $val), element('post_category', $val));
             }
             if ($param->output()) {
                 $noticeresult[$key]['post_url'] .= '?' . $param->output();
             }
             $noticeresult[$key]['is_mobile'] = element('post_device', $val) === 'mobile' ? true : false;
         }
     }
     /**
      * 게시판 목록에 필요한 정보를 가져옵니다.
      */
     $where = array('brd_id' => $this->board->item_key('brd_id', $brd_key));
     $where['post_del <>'] = 2;
     if (element('except_notice', $board) && $this->cbconfig->get_device_view_type() !== 'mobile') {
         $where['post_notice'] = 0;
     }
     if (element('mobile_except_notice', $board) && $this->cbconfig->get_device_view_type() === 'mobile') {
         $where['post_notice'] = 0;
     }
     if (element('use_personal', $board) && $is_admin === false) {
         $where['post.mem_id'] = $mem_id;
     }
     $category_id = (int) $this->input->get('category_id');
     if (empty($category_id) or $category < 1) {
         $category_id = '';
     }
     $result = $this->Post_model->get_post_list($per_page, $offset, $where, $category_id, $findex, $sfield, $skeyword);
     $list_num = $result['total_rows'] - ($page - 1) * $per_page;
     if (element('list', $result)) {
         foreach (element('list', $result) as $key => $val) {
             $result['list'][$key]['post_url'] = post_url(element('brd_key', $board), element('post_id', $val));
             $result['list'][$key]['meta'] = $meta = $this->Post_meta_model->get_all_meta(element('post_id', $val));
             if ($this->cbconfig->get_device_view_type() === 'mobile') {
                 $result['list'][$key]['title'] = element('mobile_subject_length', $board) ? cut_str(element('post_title', $val), element('mobile_subject_length', $board)) : element('post_title', $val);
             } else {
                 $result['list'][$key]['title'] = element('subject_length', $board) ? cut_str(element('post_title', $val), element('subject_length', $board)) : element('post_title', $val);
             }
             if (element('post_del', $val)) {
                 $result['list'][$key]['title'] = '게시물이 삭제 되었습니다';
             }
             $is_blind = element('blame_blind_count', $board) > 0 && element('post_blame', $val) >= element('blame_blind_count', $board) ? true : false;
             if ($is_blind) {
                 $result['list'][$key]['title'] = '신고가 접수된 게시글입니다.';
             }
             $result['list'][$key]['display_name'] = display_username(element('post_userid', $val), element('post_nickname', $val), element('mem_icon', $val), $use_sideview ? 'Y' : 'N');
             $result['list'][$key]['display_datetime'] = display_datetime(element('post_datetime', $val), $list_date_style, $list_date_style_manual);
             $result['list'][$key]['category'] = '';
             if (element('use_category', $board) && element('post_category', $val)) {
                 $result['list'][$key]['category'] = $this->Board_category_model->get_category_info(element('brd_id', $val), element('post_category', $val));
             }
             if ($param->output()) {
                 $result['list'][$key]['post_url'] .= '?' . $param->output();
             }
             $result['list'][$key]['num'] = $list_num--;
             $result['list'][$key]['is_hot'] = false;
             $hot_icon_day = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_hot_icon_day', $board) : element('hot_icon_day', $board);
             $hot_icon_hit = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_hot_icon_hit', $board) : element('hot_icon_hit', $board);
             if ($hot_icon_day && ctimestamp() - strtotime(element('post_datetime', $val)) <= $hot_icon_day * 86400) {
                 if ($hot_icon_hit && $hot_icon_hit <= element('post_hit', $val)) {
                     $result['list'][$key]['is_hot'] = true;
                 }
             }
             $result['list'][$key]['is_new'] = false;
             $new_icon_hour = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_new_icon_hour', $board) : element('new_icon_hour', $board);
             if ($new_icon_hour && ctimestamp() - strtotime(element('post_datetime', $val)) <= $new_icon_hour * 3600) {
                 $result['list'][$key]['is_new'] = true;
             }
             $result['list'][$key]['is_mobile'] = element('post_device', $val) === 'mobile' ? true : false;
             $result['list'][$key]['thumb_url'] = '';
             $result['list'][$key]['origin_image_url'] = '';
             if (element('use_gallery_list', $board)) {
                 if (element('post_image', $val)) {
                     $filewhere = array('post_id' => element('post_id', $val), 'pfi_is_image' => 1);
                     $file = $this->Post_file_model->get_one('', '', $filewhere, '', '', 'pfi_id', 'ASC');
                     $result['list'][$key]['thumb_url'] = thumb_url('post', element('pfi_filename', $file), $gallery_image_width, $gallery_image_height);
                     $result['list'][$key]['origin_image_url'] = thumb_url('post', element('pfi_filename', $file));
                 } else {
                     $thumb_url = get_post_image_url(element('post_content', $val), $gallery_image_width, $gallery_image_height);
                     $result['list'][$key]['thumb_url'] = $thumb_url ? $thumb_url : thumb_url('', '', $gallery_image_width, $gallery_image_height);
                     $result['list'][$key]['origin_image_url'] = $thumb_url;
                 }
             }
         }
     }
     $return['data'] = $result;
     $return['notice_list'] = $noticeresult;
     if (empty($from_view)) {
         $board['headercontent'] = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_header_content', $board) : element('header_content', $board);
     }
     $board['footercontent'] = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_footer_content', $board) : element('footer_content', $board);
     $board['cat_display_style'] = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_category_display_style', $board) : element('category_display_style', $board);
     $return['board'] = $board;
     $return['point_info'] = '';
     if ($this->cbconfig->item('use_point') && element('use_point', $board) && element('use_point_info', $board)) {
         $point_info = '';
         if (element('point_write', $board)) {
             $point_info .= '원글작성 : ' . element('point_write', $board) . '<br />';
         }
         if (element('point_comment', $board)) {
             $point_info .= '댓글작성 : ' . element('point_comment', $board) . '<br />';
         }
         if (element('point_fileupload', $board)) {
             $point_info .= '파일업로드 : ' . element('point_fileupload', $board) . '<br />';
         }
         if (element('point_filedownload', $board)) {
             $point_info .= '파일다운로드 : ' . element('point_filedownload', $board) . '<br />';
         }
         if (element('point_filedownload_uploader', $board)) {
             $point_info .= '파일다운로드시업로더에게 : ' . element('point_filedownload_uploader', $board) . '<br />';
         }
         if (element('point_read', $board)) {
             $point_info .= '게시글조회 : ' . element('point_read', $board) . '<br />';
         }
         if (element('point_post_like', $board)) {
             $point_info .= '원글추천함 : ' . element('point_post_like', $board) . '<br />';
         }
         if (element('point_post_dislike', $board)) {
             $point_info .= '원글비추천함 : ' . element('point_post_dislike', $board) . '<br />';
         }
         if (element('point_post_liked', $board)) {
             $point_info .= '원글추천받음 : ' . element('point_post_liked', $board) . '<br />';
         }
         if (element('point_post_disliked', $board)) {
             $point_info .= '원글비추천받음 : ' . element('point_post_disliked', $board) . '<br />';
         }
         if (element('point_comment_like', $board)) {
             $point_info .= '댓글추천함 : ' . element('point_comment_like', $board) . '<br />';
         }
         if (element('point_comment_dislike', $board)) {
             $point_info .= '댓글비추천함 : ' . element('point_comment_dislike', $board) . '<br />';
         }
         if (element('point_comment_liked', $board)) {
             $point_info .= '댓글추천받음 : ' . element('point_comment_liked', $board) . '<br />';
         }
         if (element('point_comment_disliked', $board)) {
             $point_info .= '댓글비추천받음 : ' . element('point_comment_disliked', $board) . '<br />';
         }
         $return['point_info'] = $point_info;
     }
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['step2'] = Events::trigger('step2', $eventname);
     /**
      * primary key 정보를 저장합니다
      */
     $return['primary_key'] = $this->Post_model->primary_key;
     $highlight_keyword = '';
     if ($skeyword) {
         if (!$this->session->userdata('skeyword_' . $skeyword)) {
             $sfieldarray = array('post_title', 'post_content', 'post_both');
             if (in_array($sfieldchk, $sfieldarray)) {
                 $this->load->model('Search_keyword_model');
                 $searchinsert = array('sek_keyword' => $skeyword, 'sek_datetime' => cdate('Y-m-d H:i:s'), 'sek_ip' => $this->input->ip_address(), 'mem_id' => $mem_id);
                 $this->Search_keyword_model->insert($searchinsert);
                 $this->session->set_userdata('skeyword_' . $skeyword, 1);
             }
         }
         $key_explode = explode(' ', $skeyword);
         if ($key_explode) {
             foreach ($key_explode as $seval) {
                 if ($highlight_keyword) {
                     $highlight_keyword .= ',';
                 }
                 $highlight_keyword .= '\'' . html_escape($seval) . '\'';
             }
         }
     }
     $return['highlight_keyword'] = $highlight_keyword;
     /**
      * 페이지네이션을 생성합니다
      */
     $config['base_url'] = board_url($brd_key) . '?' . $param->replace('page');
     $config['total_rows'] = $result['total_rows'];
     $config['per_page'] = $per_page;
     if ($this->cbconfig->get_device_view_type() === 'mobile') {
         $config['num_links'] = element('mobile_page_count', $board) ? element('mobile_page_count', $board) : 3;
     } else {
         $config['num_links'] = element('page_count', $board) ? element('page_count', $board) : 5;
     }
     $this->pagination->initialize($config);
     $return['paging'] = $this->pagination->create_links();
     $return['page'] = $page;
     /**
      * 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
      */
     $search_option = array('post_title' => '제목', 'post_content' => '내용');
     $return['search_option'] = search_option($search_option, $sfield);
     if ($skeyword) {
         $return['list_url'] = board_url(element('brd_key', $board));
         $return['search_list_url'] = board_url(element('brd_key', $board) . '?' . $param->output());
     } else {
         $return['list_url'] = board_url(element('brd_key', $board) . '?' . $param->output());
         $return['search_list_url'] = '';
     }
     $check = array('group_id' => element('bgr_id', $board), 'board_id' => element('brd_id', $board));
     $can_write = $this->accesslevel->is_accessable(element('access_write', $board), element('access_write_level', $board), element('access_write_group', $board), $check);
     $return['write_url'] = '';
     if ($can_write === true) {
         $return['write_url'] = write_url($brd_key);
     } elseif ($this->cbconfig->get_device_view_type() !== 'mobile' && element('always_show_write_button', $board)) {
         $return['write_url'] = 'javascript:alert(\'비회원은 글쓰기 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.\');';
     } elseif ($this->cbconfig->get_device_view_type() === 'mobile' && element('mobile_always_show_write_button', $board)) {
         $return['write_url'] = 'javascript:alert(\'비회원은 글쓰기 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.\');';
     }
     $return['list_delete_url'] = site_url('postact/listdelete/' . $brd_key . '?' . $param->output());
     return $return;
 }
Exemplo n.º 19
0
 /**
  * 오래된로그 삭제>자동로그인로그삭제 페이지입니다
  */
 public function autologin()
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_admin_config_cleanlog_autologin';
     $this->load->event($eventname);
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     /**
      * Validation 라이브러리를 가져옵니다
      */
     $this->load->library('form_validation');
     /**
      * 전송된 데이터의 유효성을 체크합니다
      */
     $config = array(array('field' => 'day', 'label' => '기간', 'rules' => 'trim|required|numeric|is_natural'));
     $this->form_validation->set_rules($config);
     /**
      * 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
      * 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
      */
     if ($this->form_validation->run() === false) {
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
     } else {
         /**
          * 유효성 검사를 통과한 경우입니다.
          * 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
          */
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
         if ($this->input->post('criterion') && $this->input->post('day')) {
             $deletewhere = array('aul_datetime <=' => $this->input->post('criterion'));
             $this->Autologin_model->delete_where($deletewhere);
             $view['view']['alert_message'] = '총 ' . number_format($this->input->post('log_count')) . ' 건의 ' . $this->input->post('day') . '일 이상된 자동로그인로그가 모두 삭제되었습니다';
         } else {
             $criterion = cdate('Y-m-d H:i:s', ctimestamp() - $this->input->post('day') * 24 * 60 * 60);
             $countwhere = array('aul_datetime <=' => $criterion);
             $log_count = $this->Autologin_model->count_by($countwhere);
             $view['view']['criterion'] = $criterion;
             $view['view']['day'] = $this->input->post('day');
             $view['view']['log_count'] = $log_count;
             if ($log_count > 0) {
                 $view['view']['msg'] = '총 ' . number_format($log_count) . ' 건의 ' . $this->input->post('day') . '일 이상된 자동로그인로그가 발견되었습니다. 이를 모두 삭제하시겠습니까?';
             } else {
                 $view['view']['alert_message'] = $this->input->post('day') . '일 이상된 자동로그인로그가 발견되지 않았습니다';
             }
         }
     }
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
     /**
      * 어드민 레이아웃을 정의합니다
      */
     $layoutconfig = array('layout' => 'layout', 'skin' => 'autologin');
     $view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
     $this->data = $view;
     $this->layout = element('layout_skin_file', element('layout', $view));
     $this->view = element('view_skin_file', element('layout', $view));
 }
Exemplo n.º 20
0
 /**
  * 아이디/패스워드찾기 페이지입니다
  */
 public function index()
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_findaccount_index';
     $this->load->event($eventname);
     if ($this->member->is_member() !== false && !($this->member->is_admin() === 'super' && $this->uri->segment(1) === config_item('uri_segment_admin'))) {
         redirect();
     }
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     $this->load->library(array('form_validation'));
     if (!function_exists('password_hash')) {
         $this->load->helper('password');
     }
     /**
      * 전송된 데이터의 유효성을 체크합니다
      */
     $config = array();
     if ($this->input->post('findtype') === 'findidpw') {
         $config[] = array('field' => 'idpw_email', 'label' => '이메일', 'rules' => 'trim|required|valid_email|callback__existemail');
     } elseif ($this->input->post('findtype') === 'verifyemail') {
         $config[] = array('field' => 'verify_email', 'label' => '이메일', 'rules' => 'trim|required|valid_email|callback__verifyemail');
     } elseif ($this->input->post('findtype') === 'changeemail') {
         $config[] = array('field' => 'change_userid', 'label' => '아이디', 'rules' => 'trim|required|alphanumunder|min_length[3]|max_length[20]');
         $config[] = array('field' => 'change_password', 'label' => '패스워드', 'rules' => 'trim|required|callback__check_id_pw[' . $this->input->post('change_userid') . ']');
         $config[] = array('field' => 'change_email', 'label' => '이메일', 'rules' => 'trim|required|valid_email|callback__change_email');
     }
     $this->form_validation->set_rules($config);
     /**
      * 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
      * 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
      */
     if ($this->form_validation->run() === false) {
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
     } else {
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
         if ($this->input->post('findtype') === 'findidpw') {
             // 이벤트가 존재하면 실행합니다
             $view['view']['event']['findidpw_before'] = Events::trigger('findidpw_before', $eventname);
             $mb = $this->Member_model->get_by_email($this->input->post('idpw_email'));
             $mem_id = (int) element('mem_id', $mb);
             $mae_type = 3;
             $vericode = array('$', '/', '.');
             $verificationcode = str_replace($vericode, '', password_hash($mem_id . '-' . $this->input->post('idpw_email') . '-' . random_string('alnum', 10), PASSWORD_BCRYPT));
             $beforeauthdata = array('mem_id' => $mem_id, 'mae_type' => $mae_type);
             $this->Member_auth_email_model->delete_where($beforeauthdata);
             $authdata = array('mem_id' => $mem_id, 'mae_key' => $verificationcode, 'mae_type' => $mae_type, 'mae_generate_datetime' => cdate('Y-m-d H:i:s'));
             $this->Member_auth_email_model->insert($authdata);
             $verify_url = site_url('verify/resetpassword?user='******'mem_userid', $mb) . '&code=' . $verificationcode);
             $searchconfig = array('{홈페이지명}', '{회사명}', '{홈페이지주소}', '{회원아이디}', '{회원닉네임}', '{회원실명}', '{회원이메일}', '{메일수신여부}', '{쪽지수신여부}', '{문자수신여부}', '{회원아이피}', '{패스워드변경주소}');
             $receive_email = element('mem_receive_email', $mb) ? '동의' : '거부';
             $receive_note = element('mem_use_note', $mb) ? '동의' : '거부';
             $receive_sms = element('mem_receive_sms', $mb) ? '동의' : '거부';
             $replaceconfig = array($this->cbconfig->item('site_title'), $this->cbconfig->item('company_name'), site_url(), element('mem_userid', $mb), element('mem_nickname', $mb), element('mem_username', $mb), element('mem_email', $mb), $receive_email, $receive_note, $receive_sms, $this->input->ip_address(), $verify_url);
             $replaceconfig_escape = array(html_escape($this->cbconfig->item('site_title')), html_escape($this->cbconfig->item('company_name')), site_url(), element('mem_userid', $mb), html_escape(element('mem_nickname', $mb)), html_escape(element('mem_username', $mb)), html_escape(element('mem_email', $mb)), $receive_email, $receive_note, $receive_sms, $this->input->ip_address(), $verify_url);
             $title = str_replace($searchconfig, $replaceconfig, $this->cbconfig->item('send_email_findaccount_user_title'));
             $content = str_replace($searchconfig, $replaceconfig_escape, $this->cbconfig->item('send_email_findaccount_user_content'));
             $this->email->clear(true);
             $this->email->from($this->cbconfig->item('webmaster_email'), $this->cbconfig->item('webmaster_name'));
             $this->email->to($this->input->post('idpw_email'));
             $this->email->subject($title);
             $this->email->message($content);
             $this->email->send();
             $view['view']['message'] = $this->input->post('idpw_email') . '로 인증메일이 발송되었습니다. <br />발송된 인증메일을 확인하신 후에 회원님의 정보 확인이 가능합니다';
             // 이벤트가 존재하면 실행합니다
             $view['view']['event']['findidpw_after'] = Events::trigger('findidpw_after', $eventname);
         } elseif ($this->input->post('findtype') === 'verifyemail') {
             // 이벤트가 존재하면 실행합니다
             $view['view']['event']['verifyemail_before'] = Events::trigger('verifyemail_before', $eventname);
             $mb = $this->Member_model->get_by_email($this->input->post('verify_email'));
             $mem_id = (int) element('mem_id', $mb);
             $mae_type = 2;
             $vericode = array('$', '/', '.');
             $verificationcode = str_replace($vericode, '', password_hash($mem_id . '-' . $this->input->post('verify_email') . '-' . random_string('alnum', 10), PASSWORD_BCRYPT));
             $beforeauthdata = array('mem_id' => $mem_id, 'mae_type' => $mae_type);
             $this->Member_auth_email_model->delete_where($beforeauthdata);
             $authdata = array('mem_id' => $mem_id, 'mae_key' => $verificationcode, 'mae_type' => $mae_type, 'mae_generate_datetime' => cdate('Y-m-d H:i:s'));
             $this->Member_auth_email_model->insert($authdata);
             $verify_url = site_url('verify/confirmemail?user='******'mem_userid', $mb) . '&code=' . $verificationcode);
             $searchconfig = array('{홈페이지명}', '{회사명}', '{홈페이지주소}', '{회원아이디}', '{회원닉네임}', '{회원실명}', '{회원이메일}', '{메일수신여부}', '{쪽지수신여부}', '{문자수신여부}', '{회원아이피}', '{메일인증주소}');
             $receive_email = element('mem_receive_email', $mb) ? '동의' : '거부';
             $receive_note = element('mem_use_note', $mb) ? '동의' : '거부';
             $receive_sms = element('mem_receive_sms', $mb) ? '동의' : '거부';
             $replaceconfig = array($this->cbconfig->item('site_title'), $this->cbconfig->item('company_name'), site_url(), element('mem_userid', $mb), element('mem_nickname', $mb), element('mem_username', $mb), element('mem_email', $mb), $receive_email, $receive_note, $receive_sms, $this->input->ip_address(), $verify_url);
             $replaceconfig_escape = array(html_escape($this->cbconfig->item('site_title')), html_escape($this->cbconfig->item('company_name')), site_url(), element('mem_userid', $mb), html_escape(element('mem_nickname', $mb)), html_escape(element('mem_username', $mb)), html_escape(element('mem_email', $mb)), $receive_email, $receive_note, $receive_sms, $this->input->ip_address(), $verify_url);
             $title = str_replace($searchconfig, $replaceconfig, $this->cbconfig->item('send_email_resendverify_user_title'));
             $content = str_replace($searchconfig, $replaceconfig_escape, $this->cbconfig->item('send_email_resendverify_user_content'));
             $this->email->clear(true);
             $this->email->from($this->cbconfig->item('webmaster_email'), $this->cbconfig->item('webmaster_name'));
             $this->email->to($this->input->post('verify_email'));
             $this->email->subject($title);
             $this->email->message($content);
             $this->email->send();
             $view['view']['message'] = $this->input->post('verify_email') . '로 인증메일이 발송되었습니다. <br />발송된 인증메일을 확인하신 후에 사이트 이용이 가능합니다';
             // 이벤트가 존재하면 실행합니다
             $view['view']['event']['verifyemail_after'] = Events::trigger('verifyemail_after', $eventname);
         } elseif ($this->input->post('findtype') === 'changeemail') {
             // 이벤트가 존재하면 실행합니다
             $view['view']['event']['changeemail_before'] = Events::trigger('changeemail_before', $eventname);
             $mb = $this->Member_model->get_by_userid($this->input->post('change_userid'));
             $mem_id = (int) element('mem_id', $mb);
             $mae_type = 2;
             $vericode = array('$', '/', '.');
             $verificationcode = str_replace($vericode, '', password_hash($mem_id . '-' . $this->input->post('change_email') . '-' . random_string('alnum', 10), PASSWORD_BCRYPT));
             $beforeauthdata = array('mem_id' => $mem_id, 'mae_type' => $mae_type);
             $this->Member_auth_email_model->delete_where($beforeauthdata);
             $authdata = array('mem_id' => $mem_id, 'mae_key' => $verificationcode, 'mae_type' => $mae_type, 'mae_generate_datetime' => cdate('Y-m-d H:i:s'));
             $this->Member_auth_email_model->insert($authdata);
             $searchconfig = array('{홈페이지명}', '{회사명}', '{홈페이지주소}', '{회원아이디}', '{회원닉네임}', '{회원실명}', '{회원이메일}', '{메일수신여부}', '{쪽지수신여부}', '{문자수신여부}', '{회원아이피}', '{패스워드변경주소}');
             $receive_email = element('mem_receive_email', $mb) ? '동의' : '거부';
             $receive_note = element('mem_use_note', $mb) ? '동의' : '거부';
             $receive_sms = element('mem_receive_sms', $mb) ? '동의' : '거부';
             $replaceconfig = array($this->cbconfig->item('site_title'), $this->cbconfig->item('company_name'), site_url(), element('mem_userid', $mb), element('mem_nickname', $mb), element('mem_username', $mb), element('mem_email', $mb), $receive_email, $receive_note, $receive_sms, $this->input->ip_address(), $verify_url);
             $replaceconfig_escape = array(html_escape($this->cbconfig->item('site_title')), html_escape($this->cbconfig->item('company_name')), site_url(), element('mem_userid', $mb), html_escape(element('mem_nickname', $mb)), html_escape(element('mem_username', $mb)), html_escape(element('mem_email', $mb)), $receive_email, $receive_note, $receive_sms, $this->input->ip_address(), $verify_url);
             $title = str_replace($searchconfig, $replaceconfig, $this->cbconfig->item('send_email_findaccount_user_title'));
             $content = str_replace($searchconfig, $replaceconfig_escape, $this->cbconfig->item('send_email_findaccount_user_content'));
             $this->email->clear(true);
             $this->email->from($this->cbconfig->item('webmaster_email'), $this->cbconfig->item('webmaster_name'));
             $this->email->to($this->input->post('change_email'));
             $this->email->subject($title);
             $this->email->message($content);
             $this->email->send();
             $view['view']['message'] = $this->input->post('change_email') . '로 인증메일이 발송되었습니다. <br />발송된 인증메일을 확인하신 후에 사이트 이용이 가능합니다';
             // 이벤트가 존재하면 실행합니다
             $view['view']['event']['changeemail_after'] = Events::trigger('changeemail_after', $eventname);
         }
     }
     $view['view']['canonical'] = site_url('findaccount');
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
     /**
      * 레이아웃을 정의합니다
      */
     $page_title = $this->cbconfig->item('site_meta_title_findaccount');
     $meta_description = $this->cbconfig->item('site_meta_description_findaccount');
     $meta_keywords = $this->cbconfig->item('site_meta_keywords_findaccount');
     $meta_author = $this->cbconfig->item('site_meta_author_findaccount');
     $page_name = $this->cbconfig->item('site_page_name_findaccount');
     $layoutconfig = array('path' => 'findaccount', 'layout' => 'layout', 'skin' => 'findaccount', 'layout_dir' => $this->cbconfig->item('layout_findaccount'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_findaccount'), 'use_sidebar' => $this->cbconfig->item('sidebar_findaccount'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_findaccount'), 'skin_dir' => $this->cbconfig->item('skin_findaccount'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_findaccount'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name);
     $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->get_device_view_type());
     $this->data = $view;
     $this->layout = element('layout_skin_file', element('layout', $view));
     $this->view = element('view_skin_file', element('layout', $view));
 }
Exemplo n.º 21
0
$uname = $user['name'];
if ($user['displayname']) {
    $uname = $user['displayname'];
}
$title = __('Edit profile');
makeCrumbs(array(actionLink("profile", $userid, "", $user['name']) => htmlspecialchars($uname), '' => __("Edit profile")));
loadRanksets();
$ranksets = $ranksetNames;
$ranksets = array_reverse($ranksets);
$ranksets[''] = __("None");
$ranksets = array_reverse($ranksets);
foreach ($dateformats as $format) {
    $datelist[$format] = $format ? $format . ' (' . cdate($format) . ')' : '';
}
foreach ($timeformats as $format) {
    $timelist[$format] = $format ? $format . ' (' . cdate($format) . ')' : '';
}
$sexes = array(__("Male"), __("Female"), __("N/A"));
$groups = array();
$r = Query("SELECT id,title FROM {usergroups} WHERE type=0 AND rank<={0} ORDER BY rank", $loguserGroup['rank']);
while ($g = Fetch($r)) {
    $groups[$g['id']] = htmlspecialchars($g['title']);
}
$pltype = Settings::get('postLayoutType');
$epPages = array();
$epCategories = array();
$epFields = array();
// EDITPROFILE TAB -- GENERAL -------------------------------------------------
AddPage('general', __('General'));
AddCategory('general', 'appearance', __('Appearance'));
if ($editUserMode || HasPermission('user.editdisplayname')) {
Exemplo n.º 22
0
		</tr>';
$today = cdate($mydatefmt, time());
$yesterday = cdate($mydatefmt, time() - 86400);
$lastts = 'lol';
$c = 1;
$mindate = time() - $time;
$changes = Query("\tSELECT\n\t\t\t\t\t\tpt.*,\n\t\t\t\t\t\tu.(_userfields)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{wiki_pages_text} pt\n\t\t\t\t\t\tLEFT JOIN {users} u ON u.id=pt.user\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tpt.date > {0}\n\t\t\t\t\tORDER BY pt.date DESC", $mindate);
if (!NumRows($changes)) {
    echo '
		<tr class="cell1">
			<td colspan="2">No changes to display.</td>
		</tr>';
} else {
    while ($change = Fetch($changes)) {
        $date = $change['date'];
        $ts = cdate($mydatefmt, $date);
        if ($ts == $today) {
            $ts = 'Today';
        } else {
            if ($ts == $yesterday) {
                $ts = 'Yesterday';
            }
        }
        if ($ts != $lastts) {
            $lastts = $ts;
            echo '
		<tr class="header0">
			<th colspan="2">' . $ts . '</th>
		</tr>';
        }
        $user = getDataPrefix($change, 'u_');
Exemplo n.º 23
0
 public function update($primary_value = '', $updatedata = '', $where = '')
 {
     $result = parent::update($primary_value, $updatedata);
     $this->cache->delete('popup-info-' . cdate('Y-m-d'));
     return $result;
 }
Exemplo n.º 24
0
 /**
  * 회원가입 폼 페이지입니다
  */
 public function form()
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_register_form';
     $this->load->event($eventname);
     if ($this->member->is_member() && !($this->member->is_admin() === 'super' && $this->uri->segment(1) === config_item('uri_segment_admin'))) {
         redirect();
     }
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     if ($this->cbconfig->item('use_register_block')) {
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['before_block_layout'] = Events::trigger('before_block_layout', $eventname);
         /**
          * 레이아웃을 정의합니다
          */
         $page_title = $this->cbconfig->item('site_meta_title_register_form');
         $meta_description = $this->cbconfig->item('site_meta_description_register_form');
         $meta_keywords = $this->cbconfig->item('site_meta_keywords_register_form');
         $meta_author = $this->cbconfig->item('site_meta_author_register_form');
         $page_name = $this->cbconfig->item('site_page_name_register_form');
         $layoutconfig = array('path' => 'register', 'layout' => 'layout', 'skin' => 'register_block', 'layout_dir' => $this->cbconfig->item('layout_register'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_register'), 'use_sidebar' => $this->cbconfig->item('sidebar_register'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_register'), 'skin_dir' => $this->cbconfig->item('skin_register'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_register'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name);
         $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->get_device_view_type());
         $this->data = $view;
         $this->layout = element('layout_skin_file', element('layout', $view));
         $this->view = element('view_skin_file', element('layout', $view));
         return false;
     }
     $password_length = $this->cbconfig->item('password_length');
     $email_description = '';
     if ($this->cbconfig->item('use_register_email_auth')) {
         $email_description = '회원가입 후 인증메일이 발송됩니다. 인증메일을 확인하신 후에 사이트 이용이 가능합니다';
     }
     $configbasic = array();
     $nickname_description = '';
     if ($this->cbconfig->item('change_nickname_date')) {
         $nickname_description = '<br />닉네임을 입력하시면 앞으로 ' . $this->cbconfig->item('change_nickname_date') . '일 이내에는 변경할 수 없습니다';
     }
     $configbasic['mem_userid'] = array('field' => 'mem_userid', 'label' => '아이디', 'rules' => 'trim|required|alphanumunder|min_length[3]|max_length[20]|is_unique[member.mem_userid]|callback__mem_userid_check', 'description' => '영문자, 숫자, _ 만 입력 가능. 최소 3자이상 입력하세요');
     $password_description = '비밀번호는 ' . $password_length . '자리 이상이어야 ';
     if ($this->cbconfig->item('password_uppercase_length') or $this->cbconfig->item('password_numbers_length') or $this->cbconfig->item('password_specialchars_length')) {
         $password_description .= '하며 ';
         if ($this->cbconfig->item('password_uppercase_length')) {
             $password_description .= ', ' . $this->cbconfig->item('password_uppercase_length') . '개의 대문자';
         }
         if ($this->cbconfig->item('password_numbers_length')) {
             $password_description .= ', ' . $this->cbconfig->item('password_numbers_length') . '개의 숫자';
         }
         if ($this->cbconfig->item('password_specialchars_length')) {
             $password_description .= ', ' . $this->cbconfig->item('password_specialchars_length') . '개의 특수문자';
         }
         $password_description .= '를 포함해야 ';
     }
     $password_description .= '합니다';
     $configbasic['mem_password'] = array('field' => 'mem_password', 'label' => '패스워드', 'rules' => 'trim|required|min_length[' . $password_length . ']|callback__mem_password_check', 'description' => $password_description);
     $configbasic['mem_password_re'] = array('field' => 'mem_password_re', 'label' => '패스워드 확인', 'rules' => 'trim|required|min_length[' . $password_length . ']|matches[mem_password]');
     $configbasic['mem_username'] = array('field' => 'mem_username', 'label' => '이름', 'rules' => 'trim|min_length[2]|max_length[20]');
     $configbasic['mem_nickname'] = array('field' => 'mem_nickname', 'label' => '닉네임', 'rules' => 'trim|required|min_length[2]|max_length[20]|callback__mem_nickname_check', 'description' => '공백없이 한글, 영문, 숫자만 입력 가능 2글자 이상' . $nickname_description);
     $configbasic['mem_email'] = array('field' => 'mem_email', 'label' => '이메일', 'rules' => 'trim|required|valid_email|max_length[50]|is_unique[member.mem_email]|callback__mem_email_check', 'description' => $email_description);
     $configbasic['mem_homepage'] = array('field' => 'mem_homepage', 'label' => '홈페이지', 'rules' => 'prep_url|valid_url');
     $configbasic['mem_phone'] = array('field' => 'mem_phone', 'label' => '전화번호', 'rules' => 'trim|valid_phone');
     $configbasic['mem_birthday'] = array('field' => 'mem_birthday', 'label' => '생년월일', 'rules' => 'trim|exact_length[10]');
     $configbasic['mem_sex'] = array('field' => 'mem_sex', 'label' => '성별', 'rules' => 'trim|exact_length[1]');
     $configbasic['mem_zipcode'] = array('field' => 'mem_zipcode', 'label' => '우편번호', 'rules' => 'trim|exact_length[7]');
     $configbasic['mem_address1'] = array('field' => 'mem_address1', 'label' => '기본주소', 'rules' => 'trim');
     $configbasic['mem_address2'] = array('field' => 'mem_address2', 'label' => '상세주소', 'rules' => 'trim');
     $configbasic['mem_address3'] = array('field' => 'mem_address3', 'label' => '참고항목', 'rules' => 'trim');
     $configbasic['mem_address4'] = array('field' => 'mem_address4', 'label' => '지번', 'rules' => 'trim');
     $configbasic['mem_profile_content'] = array('field' => 'mem_profile_content', 'label' => '자기소개', 'rules' => 'trim');
     $configbasic['mem_open_profile'] = array('field' => 'mem_open_profile', 'label' => '정보공개', 'rules' => 'trim|exact_length[1]');
     if ($this->cbconfig->item('use_note')) {
         $configbasic['mem_use_note'] = array('field' => 'mem_use_note', 'label' => '쪽지사용', 'rules' => 'trim|exact_length[1]');
     }
     $configbasic['mem_receive_email'] = array('field' => 'mem_receive_email', 'label' => '이메일수신여부', 'rules' => 'trim|exact_length[1]');
     $configbasic['mem_receive_sms'] = array('field' => 'mem_receive_sms', 'label' => 'SMS 문자수신여부', 'rules' => 'trim|exact_length[1]');
     $configbasic['mem_recommend'] = array('field' => 'mem_recommend', 'label' => '추천인아이디', 'rules' => 'trim|alphanumunder|min_length[3]|max_length[20]|callback__mem_recommend_check');
     if ($this->member->is_admin() === false && !$this->session->userdata('registeragree')) {
         $this->session->set_flashdata('message', '회원가입약관동의와 개인정보취급방침동의후 회원가입이 가능합니다');
         redirect('register');
     }
     $registerform = $this->cbconfig->item('registerform');
     $form = json_decode($registerform, true);
     $config = array();
     if ($form && is_array($form)) {
         foreach ($form as $key => $value) {
             if (!element('use', $value)) {
                 continue;
             }
             if (element('func', $value) === 'basic') {
                 if ($key === 'mem_address') {
                     if (element('required', $value) === '1') {
                         $configbasic['mem_zipcode']['rules'] = $configbasic['mem_zipcode']['rules'] . '|required';
                     }
                     $config[] = $configbasic['mem_zipcode'];
                     if (element('required', $value) === '1') {
                         $configbasic['mem_address1']['rules'] = $configbasic['mem_address1']['rules'] . '|required';
                     }
                     $config[] = $configbasic['mem_address1'];
                     if (element('required', $value) === '1') {
                         $configbasic['mem_address2']['rules'] = $configbasic['mem_address2']['rules'] . '|required';
                     }
                     $config[] = $configbasic['mem_address2'];
                 } else {
                     if (element('required', $value) === '1') {
                         $configbasic[$value['field_name']]['rules'] = $configbasic[$value['field_name']]['rules'] . '|required';
                     }
                     if (element('field_type', $value) === 'phone') {
                         $configbasic[$value['field_name']]['rules'] = $configbasic[$value['field_name']]['rules'] . '|valid_phone';
                     }
                     $config[] = $configbasic[$value['field_name']];
                     if ($key === 'mem_password') {
                         $config[] = $configbasic['mem_password_re'];
                     }
                 }
             } else {
                 $required = element('required', $value) ? '|required' : '';
                 if (element('field_type', $value) === 'checkbox') {
                     $config[] = array('field' => element('field_name', $value) . '[]', 'label' => element('display_name', $value), 'rules' => 'trim' . $required);
                 } else {
                     $config[] = array('field' => element('field_name', $value), 'label' => element('display_name', $value), 'rules' => 'trim' . $required);
                 }
             }
         }
     }
     if ($this->cbconfig->item('use_recaptcha')) {
         $config[] = array('field' => 'g-recaptcha-response', 'label' => '자동등록방지문자', 'rules' => 'trim|required|callback__check_recaptcha');
     } else {
         $config[] = array('field' => 'captcha_key', 'label' => '자동등록방지문자', 'rules' => 'trim|required|callback__check_captcha');
     }
     $this->form_validation->set_rules($config);
     $form_validation = $this->form_validation->run();
     $file_error = '';
     $updatephoto = '';
     $file_error2 = '';
     $updateicon = '';
     if ($form_validation) {
         $this->load->library('upload');
         if ($this->cbconfig->item('use_member_photo') && $this->cbconfig->item('member_photo_width') > 0 && $this->cbconfig->item('member_photo_height') > 0) {
             if (isset($_FILES) && isset($_FILES['mem_photo']) && isset($_FILES['mem_photo']['name']) && $_FILES['mem_photo']['name']) {
                 $upload_path = './uploads/member_photo/';
                 if (is_dir($upload_path) === false) {
                     mkdir($upload_path, 0707);
                     $file = $upload_path . 'index.php';
                     $f = @fopen($file, 'w');
                     @fwrite($f, '');
                     @fclose($f);
                     @chmod($file, 0644);
                 }
                 $upload_path .= cdate('Y') . '/';
                 if (is_dir($upload_path) === false) {
                     mkdir($upload_path, 0707);
                     $file = $upload_path . 'index.php';
                     $f = @fopen($file, 'w');
                     @fwrite($f, '');
                     @fclose($f);
                     @chmod($file, 0644);
                 }
                 $upload_path .= cdate('m') . '/';
                 if (is_dir($upload_path) === false) {
                     mkdir($upload_path, 0707);
                     $file = $upload_path . 'index.php';
                     $f = @fopen($file, 'w');
                     @fwrite($f, '');
                     @fclose($f);
                     @chmod($file, 0644);
                 }
                 $uploadconfig = '';
                 $uploadconfig['upload_path'] = $upload_path;
                 $uploadconfig['allowed_types'] = 'jpg|jpeg|png|gif';
                 $uploadconfig['max_size'] = '2000';
                 $uploadconfig['max_width'] = '1000';
                 $uploadconfig['max_height'] = '1000';
                 $uploadconfig['encrypt_name'] = true;
                 $this->upload->initialize($uploadconfig);
                 if ($this->upload->do_upload('mem_photo')) {
                     $img = $this->upload->data();
                     $updatephoto = cdate('Y') . '/' . cdate('m') . '/' . $img['file_name'];
                 } else {
                     $file_error = $this->upload->display_errors();
                 }
             }
         }
         if ($this->cbconfig->item('use_member_icon') && $this->cbconfig->item('member_icon_width') > 0 && $this->cbconfig->item('member_icon_height') > 0) {
             if (isset($_FILES) && isset($_FILES['mem_icon']) && isset($_FILES['mem_icon']['name']) && $_FILES['mem_icon']['name']) {
                 $upload_path = './uploads/member_icon/';
                 if (is_dir($upload_path) === false) {
                     mkdir($upload_path, 0707);
                     $file = $upload_path . 'index.php';
                     $f = @fopen($file, 'w');
                     @fwrite($f, '');
                     @fclose($f);
                     @chmod($file, 0644);
                 }
                 $upload_path .= cdate('Y') . '/';
                 if (is_dir($upload_path) === false) {
                     mkdir($upload_path, 0707);
                     $file = $upload_path . 'index.php';
                     $f = @fopen($file, 'w');
                     @fwrite($f, '');
                     @fclose($f);
                     @chmod($file, 0644);
                 }
                 $upload_path .= cdate('m') . '/';
                 if (is_dir($upload_path) === false) {
                     mkdir($upload_path, 0707);
                     $file = $upload_path . 'index.php';
                     $f = @fopen($file, 'w');
                     @fwrite($f, '');
                     @fclose($f);
                     @chmod($file, 0644);
                 }
                 $uploadconfig = '';
                 $uploadconfig['upload_path'] = $upload_path;
                 $uploadconfig['allowed_types'] = 'jpg|jpeg|png|gif';
                 $uploadconfig['max_size'] = '2000';
                 $uploadconfig['max_width'] = '1000';
                 $uploadconfig['max_height'] = '1000';
                 $uploadconfig['encrypt_name'] = true;
                 $this->upload->initialize($uploadconfig);
                 if ($this->upload->do_upload('mem_icon')) {
                     $img = $this->upload->data();
                     $updateicon = cdate('Y') . '/' . cdate('m') . '/' . $img['file_name'];
                 } else {
                     $file_error2 = $this->upload->display_errors();
                 }
             }
         }
     }
     /**
      * 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
      * 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
      */
     if ($form_validation === false or $file_error !== '' or $file_error2 !== '') {
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
         $html_content = array();
         $k = 0;
         if ($form && is_array($form)) {
             foreach ($form as $key => $value) {
                 if (!element('use', $value)) {
                     continue;
                 }
                 $required = element('required', $value) ? 'required' : '';
                 $html_content[$k]['field_name'] = element('field_name', $value);
                 $html_content[$k]['display_name'] = element('display_name', $value);
                 $html_content[$k]['input'] = '';
                 //field_type : text, url, email, phone, textarea, radio, select, checkbox, date
                 if (element('field_type', $value) === 'text' or element('field_type', $value) === 'url' or element('field_type', $value) === 'email' or element('field_type', $value) === 'phone' or element('field_type', $value) === 'date') {
                     if (element('field_type', $value) === 'date') {
                         $html_content[$k]['input'] .= '<input type="text" id="' . element('field_name', $value) . '" name="' . element('field_name', $value) . '" class="form-control input datepicker" value="' . set_value(element('field_name', $value)) . '" readonly="readonly" ' . $required . ' />';
                     } elseif (element('field_type', $value) === 'phone') {
                         $html_content[$k]['input'] .= '<input type="text" id="' . element('field_name', $value) . '" name="' . element('field_name', $value) . '" class="form-control input validphone" value="' . set_value(element('field_name', $value)) . '" ' . $required . ' />';
                     } else {
                         $html_content[$k]['input'] .= '<input type="' . element('field_type', $value) . '" id="' . element('field_name', $value) . '" name="' . element('field_name', $value) . '" class="form-control input" value="' . set_value(element('field_name', $value)) . '" ' . $required . '/>';
                     }
                 } elseif (element('field_type', $value) === 'textarea') {
                     $html_content[$k]['input'] .= '<textarea id="' . element('field_name', $value) . '" name="' . element('field_name', $value) . '" class="form-control input" ' . $required . '>' . set_value(element('field_name', $value)) . '</textarea>';
                 } elseif (element('field_type', $value) === 'radio') {
                     $html_content[$k]['input'] .= '<div class="checkbox">';
                     if (element('field_name', $value) === 'mem_sex') {
                         $options = array('1' => '남성', '2' => '여성');
                     } else {
                         $options = explode("\n", element('options', $value));
                     }
                     $i = 1;
                     if ($options) {
                         foreach ($options as $okey => $oval) {
                             $radiovalue = element('field_name', $value) === 'mem_sex' ? $okey : $oval;
                             $html_content[$k]['input'] .= '<label for="' . element('field_name', $value) . '_' . $i . '"><input type="radio" name="' . element('field_name', $value) . '" id="' . element('field_name', $value) . '_' . $i . '" value="' . $radiovalue . '" ' . set_radio(element('field_name', $value), $radiovalue) . ' /> ' . $oval . ' </label> ';
                             $i++;
                         }
                     }
                     $html_content[$k]['input'] .= '</div>';
                 } elseif (element('field_type', $value) === 'checkbox') {
                     $html_content[$k]['input'] .= '<div class="checkbox">';
                     $options = explode("\n", element('options', $value));
                     $i = 1;
                     if ($options) {
                         foreach ($options as $okey => $oval) {
                             $html_content[$k]['input'] .= '<label for="' . element('field_name', $value) . '_' . $i . '"><input type="checkbox" name="' . element('field_name', $value) . '[]" id="' . element('field_name', $value) . '_' . $i . '" value="' . $oval . '" ' . set_checkbox(element('field_name', $value), $oval) . ' /> ' . $oval . ' </label> ';
                             $i++;
                         }
                     }
                     $html_content[$k]['input'] .= '</div>';
                 } elseif (element('field_type', $value) === 'select') {
                     $html_content[$k]['input'] .= '<div class="input-group">';
                     $html_content[$k]['input'] .= '<select name="' . element('field_name', $value) . '" class="form-control input" ' . $required . '>';
                     $html_content[$k]['input'] .= '<option value="" >선택하세요</option> ';
                     $options = explode("\n", element('options', $value));
                     if ($options) {
                         foreach ($options as $okey => $oval) {
                             $html_content[$k]['input'] .= '<option value="' . $oval . '" ' . set_select(element('field_name', $value), $oval) . ' >' . $oval . '</option> ';
                         }
                     }
                     $html_content[$k]['input'] .= '</select>';
                     $html_content[$k]['input'] .= '</div>';
                 } elseif (element('field_name', $value) === 'mem_address') {
                     $html_content[$k]['input'] .= '
                         <label for="mem_zipcode">우편번호</label>
                         <label>
                             <input type="text" name="mem_zipcode" value="' . set_value('mem_zipcode') . '" id="mem_zipcode" class="form-control input" size="7" maxlength="7" ' . $required . '/>
                         </label>
                         <label>
                             <button type="button" class="btn btn-black btn-sm" style="margin-top:0px;" onclick="win_zip(\'fregisterform\', \'mem_zipcode\', \'mem_address1\', \'mem_address2\', \'mem_address3\', \'mem_address4\');">주소 검색</button>
                         </label>
                         <div class="addr-line mt10">
                             <label for="mem_address1">기본주소</label>
                             <input type="text" name="mem_address1" value="' . set_value('mem_address1') . '" id="mem_address1" class="form-control input" placeholder="기본주소" ' . $required . ' />
                         </div>
                         <div class="addr-line mt10">
                             <label for="mem_address2">상세주소</label>
                             <input type="text" name="mem_address2" value="' . set_value('mem_address2') . '" id="mem_address2" class="form-control input" placeholder="상세주소" ' . $required . ' />
                         </div>
                         <div class="addr-line mt10">
                             <label for="mem_address3">참고항목</label>
                             <input type="text" name="mem_address3" value="' . set_value('mem_address3') . '" id="mem_address3" class="form-control input" readonly="readonly" placeholder="참고항목" />
                         </div>
                         <input type="hidden" name="mem_address4" value="' . set_value('mem_address4') . '" />
                     ';
                 } elseif (element('field_name', $value) === 'mem_password') {
                     $html_content[$k]['input'] .= '<input type="' . element('field_type', $value) . '" id="' . element('field_name', $value) . '" name="' . element('field_name', $value) . '" class="form-control input" minlength="' . $password_length . '" />';
                 }
                 $html_content[$k]['description'] = '';
                 if (isset($configbasic[$value['field_name']]['description']) && $configbasic[$value['field_name']]['description']) {
                     $html_content[$k]['description'] = $configbasic[$value['field_name']]['description'];
                 }
                 if (element('field_name', $value) === 'mem_password') {
                     $k++;
                     $html_content[$k]['field_name'] = 'mem_password_re';
                     $html_content[$k]['display_name'] = '비밀번호 확인';
                     $html_content[$k]['input'] = '<input type="password" id="mem_password_re" name="mem_password_re" class="form-control input" minlength="' . $password_length . '" />';
                 }
                 $k++;
             }
         }
         $view['view']['html_content'] = $html_content;
         $view['view']['open_profile_description'] = '';
         if ($this->cbconfig->item('change_open_profile_date')) {
             $view['view']['open_profile_description'] = '정보공개 설정은 ' . $this->cbconfig->item('change_open_profile_date') . '일 이내에는 변경할 수 없습니다';
         }
         $view['view']['use_note_description'] = '';
         if ($this->cbconfig->item('change_use_note_date')) {
             $view['view']['use_note_description'] = '쪽지 기능 사용 설정은 ' . $this->cbconfig->item('change_use_note_date') . '일 이내에는 변경할 수 없습니다';
         }
         $view['view']['canonical'] = site_url('register/form');
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
         /**
          * 레이아웃을 정의합니다
          */
         $page_title = $this->cbconfig->item('site_meta_title_register_form');
         $meta_description = $this->cbconfig->item('site_meta_description_register_form');
         $meta_keywords = $this->cbconfig->item('site_meta_keywords_register_form');
         $meta_author = $this->cbconfig->item('site_meta_author_register_form');
         $page_name = $this->cbconfig->item('site_page_name_register_form');
         $layoutconfig = array('path' => 'register', 'layout' => 'layout', 'skin' => 'register_form', 'layout_dir' => $this->cbconfig->item('layout_register'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_register'), 'use_sidebar' => $this->cbconfig->item('sidebar_register'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_register'), 'skin_dir' => $this->cbconfig->item('skin_register'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_register'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name);
         $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->get_device_view_type());
         $this->data = $view;
         $this->layout = element('layout_skin_file', element('layout', $view));
         $this->view = element('view_skin_file', element('layout', $view));
     } else {
         /**
          * 유효성 검사를 통과한 경우입니다.
          * 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
          */
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
         $mem_level = (int) $this->cbconfig->item('register_level');
         $insertdata = array();
         $metadata = array();
         $insertdata['mem_userid'] = $this->input->post('mem_userid');
         $insertdata['mem_email'] = $this->input->post('mem_email');
         $insertdata['mem_password'] = password_hash($this->input->post('mem_password'), PASSWORD_BCRYPT);
         $insertdata['mem_nickname'] = $this->input->post('mem_nickname');
         $metadata['meta_nickname_datetime'] = cdate('Y-m-d H:i:s');
         $insertdata['mem_level'] = $mem_level;
         if (isset($form['mem_username']['use']) && $form['mem_username']['use']) {
             $insertdata['mem_username'] = $this->input->post('mem_username', null, '');
         }
         if (isset($form['mem_homepage']['use']) && $form['mem_homepage']['use']) {
             $insertdata['mem_homepage'] = $this->input->post('mem_homepage', null, '');
         }
         if (isset($form['mem_phone']['use']) && $form['mem_phone']['use']) {
             $insertdata['mem_phone'] = $this->input->post('mem_phone', null, '');
         }
         if (isset($form['mem_birthday']['use']) && $form['mem_birthday']['use']) {
             $insertdata['mem_birthday'] = $this->input->post('mem_birthday', null, '');
         }
         if (isset($form['mem_sex']['use']) && $form['mem_sex']['use']) {
             $insertdata['mem_sex'] = $this->input->post('mem_sex', null, '');
         }
         if (isset($form['mem_address']['use']) && $form['mem_address']['use']) {
             $insertdata['mem_zipcode'] = $this->input->post('mem_zipcode', null, '');
             $insertdata['mem_address1'] = $this->input->post('mem_address1', null, '');
             $insertdata['mem_address2'] = $this->input->post('mem_address2', null, '');
             $insertdata['mem_address3'] = $this->input->post('mem_address3', null, '');
             $insertdata['mem_address4'] = $this->input->post('mem_address4', null, '');
         }
         $insertdata['mem_receive_email'] = $this->input->post('mem_receive_email') ? 1 : 0;
         if ($this->cbconfig->item('use_note')) {
             $insertdata['mem_use_note'] = $this->input->post('mem_use_note') ? 1 : 0;
             $metadata['meta_use_note_datetime'] = cdate('Y-m-d H:i:s');
         }
         $insertdata['mem_receive_sms'] = $this->input->post('mem_receive_sms') ? 1 : 0;
         $insertdata['mem_open_profile'] = $this->input->post('mem_open_profile') ? 1 : 0;
         $metadata['meta_open_profile_datetime'] = cdate('Y-m-d H:i:s');
         $insertdata['mem_register_datetime'] = cdate('Y-m-d H:i:s');
         $insertdata['mem_register_ip'] = $this->input->ip_address();
         $metadata['meta_change_pw_datetime'] = cdate('Y-m-d H:i:s');
         if (isset($form['mem_profile_content']['use']) && $form['mem_profile_content']['use']) {
             $insertdata['mem_profile_content'] = $this->input->post('mem_profile_content', null, '');
         }
         if ($this->cbconfig->item('use_register_email_auth')) {
             $insertdata['mem_email_cert'] = 0;
             $metadata['meta_email_cert_datetime'] = '';
         } else {
             $insertdata['mem_email_cert'] = 1;
             $metadata['meta_email_cert_datetime'] = cdate('Y-m-d H:i:s');
         }
         if ($updatephoto) {
             $insertdata['mem_photo'] = $updatephoto;
         }
         if ($updateicon) {
             $insertdata['mem_icon'] = $updateicon;
         }
         $mem_id = $this->Member_model->insert($insertdata);
         $this->Member_meta_model->save($mem_id, $metadata);
         $nickinsert = array('mem_id' => $mem_id, 'mni_nickname' => $this->input->post('mem_nickname'), 'mni_start_datetime' => cdate('Y-m-d H:i:s'));
         $this->Member_nickname_model->insert($nickinsert);
         $extradata = array();
         if ($form && is_array($form)) {
             foreach ($form as $key => $value) {
                 if (!element('use', $value)) {
                     continue;
                 }
                 if (element('func', $value) === 'basic') {
                     continue;
                 }
                 $extradata[element('field_name', $value)] = $this->input->post(element('field_name', $value), null, '');
             }
             $this->Member_extra_vars_model->save($mem_id, $extradata);
         }
         $this->point->insert_point($mem_id, $this->cbconfig->item('point_register'), '회원가입을 축하합니다', 'member', $mem_id, '회원가입');
         $searchconfig = array('{홈페이지명}', '{회사명}', '{홈페이지주소}', '{회원아이디}', '{회원닉네임}', '{회원실명}', '{회원이메일}', '{메일수신여부}', '{쪽지수신여부}', '{문자수신여부}', '{회원아이피}');
         $mem_userid = $this->input->post('mem_userid', null, '');
         $mem_nickname = $this->input->post('mem_nickname', null, '');
         $mem_username = $this->input->post('mem_username', null, '');
         $mem_email = $this->input->post('mem_email', null, '');
         $receive_email = $this->input->post('mem_receive_email') ? '동의' : '거부';
         $receive_note = $this->input->post('mem_use_note') ? '동의' : '거부';
         $receive_sms = $this->input->post('mem_receive_sms') ? '동의' : '거부';
         $replaceconfig = array($this->cbconfig->item('site_title'), $this->cbconfig->item('company_name'), site_url(), $mem_userid, $mem_nickname, $mem_username, $mem_email, $receive_email, $receive_note, $receive_sms, $this->input->ip_address());
         $replaceconfig_escape = array(html_escape($this->cbconfig->item('site_title')), html_escape($this->cbconfig->item('company_name')), site_url(), html_escape($mem_userid), html_escape($mem_nickname), html_escape($mem_username), html_escape($mem_email), $receive_email, $receive_note, $receive_sms, $this->input->ip_address());
         if (!$this->cbconfig->item('use_register_email_auth')) {
             if ($this->cbconfig->item('send_email_register_user') && $this->input->post('mem_receive_email') or $this->cbconfig->item('send_email_register_alluser')) {
                 $title = str_replace($searchconfig, $replaceconfig, $this->cbconfig->item('send_email_register_user_title'));
                 $content = str_replace($searchconfig, $replaceconfig_escape, $this->cbconfig->item('send_email_register_user_content'));
                 $this->email->from($this->cbconfig->item('webmaster_email'), $this->cbconfig->item('webmaster_name'));
                 $this->email->to($this->input->post('mem_email'));
                 $this->email->subject($title);
                 $this->email->message($content);
                 $this->email->send();
             }
         } else {
             $vericode = array('$', '/', '.');
             $verificationcode = str_replace($vericode, '', password_hash($mem_id . '-' . $this->input->post('mem_email') . '-' . random_string('alnum', 10), PASSWORD_BCRYPT));
             $beforeauthdata = array('mem_id' => $mem_id, 'mae_type' => 1);
             $this->Member_auth_email_model->delete_where($beforeauthdata);
             $authdata = array('mem_id' => $mem_id, 'mae_key' => $verificationcode, 'mae_type' => 1, 'mae_generate_datetime' => cdate('Y-m-d H:i:s'));
             $this->Member_auth_email_model->insert($authdata);
             $verify_url = site_url('verify/confirmemail?user='******'mem_userid') . '&code=' . $verificationcode);
             $title = str_replace($searchconfig, $replaceconfig, $this->cbconfig->item('send_email_register_user_verifytitle'));
             $content = str_replace($searchconfig, $replaceconfig_escape, $this->cbconfig->item('send_email_register_user_verifycontent'));
             $title = str_replace('{메일인증주소}', $verify_url, $title);
             $content = str_replace('{메일인증주소}', $verify_url, $content);
             $this->email->from($this->cbconfig->item('webmaster_email'), $this->cbconfig->item('webmaster_name'));
             $this->email->to($this->input->post('mem_email'));
             $this->email->subject($title);
             $this->email->message($content);
             $this->email->send();
             $email_auth_message = $this->input->post('mem_email') . '로 인증메일이 발송되었습니다. <br />발송된 인증메일을 확인하신 후에 사이트 이용이 가능합니다';
             $this->session->set_flashdata('email_auth_message', $email_auth_message);
         }
         $emailsendlistadmin = array();
         $notesendlistadmin = array();
         $notesendlistuser = array();
         $superadminlist = '';
         if ($this->cbconfig->item('send_email_register_admin') or $this->cbconfig->item('send_note_register_admin')) {
             $mselect = 'mem_id, mem_email, mem_nickname, mem_phone';
             $superadminlist = $this->Member_model->get_superadmin_list($mselect);
         }
         if ($this->cbconfig->item('send_email_register_admin') && $superadminlist) {
             foreach ($superadminlist as $key => $value) {
                 $emailsendlistadmin[$value['mem_id']] = $value;
             }
         }
         if ($this->cbconfig->item('send_note_register_admin') && $superadminlist) {
             foreach ($superadminlist as $key => $value) {
                 $notesendlistadmin[$value['mem_id']] = $value;
             }
         }
         if ($this->cbconfig->item('send_note_register_user') && $this->input->post('mem_use_note')) {
             $notesendlistuser['mem_id'] = $mem_id;
         }
         if ($this->cbconfig->item('send_email_register_admin') or $this->cbconfig->item('send_note_register_admin')) {
             $mselect = 'mem_id, mem_email, mem_nickname, mem_phone';
             $adminlist = $this->Member_model->get_superadmin_list($mselect);
         }
         if ($emailsendlistadmin) {
             $title = str_replace($searchconfig, $replaceconfig, $this->cbconfig->item('send_email_register_admin_title'));
             $content = str_replace($searchconfig, $replaceconfig_escape, $this->cbconfig->item('send_email_register_admin_content'));
             foreach ($emailsendlistadmin as $akey => $aval) {
                 $this->email->clear(true);
                 $this->email->from($this->cbconfig->item('webmaster_email'), $this->cbconfig->item('webmaster_name'));
                 $this->email->to(element('mem_email', $aval));
                 $this->email->subject($title);
                 $this->email->message($content);
                 $this->email->send();
             }
         }
         if ($notesendlistadmin) {
             $title = str_replace($searchconfig, $replaceconfig, $this->cbconfig->item('send_note_register_admin_title'));
             $content = str_replace($searchconfig, $replaceconfig_escape, $this->cbconfig->item('send_note_register_admin_content'));
             foreach ($notesendlistadmin as $akey => $aval) {
                 $note_result = $this->notelib->send_note($sender = 0, $receiver = element('mem_id', $aval), $title, $content, 1);
             }
         }
         if ($notesendlistuser && element('mem_id', $notesendlistuser)) {
             $title = str_replace($searchconfig, $replaceconfig, $this->cbconfig->item('send_note_register_user_title'));
             $content = str_replace($searchconfig, $replaceconfig_escape, $this->cbconfig->item('send_note_register_user_content'));
             $note_result = $this->notelib->send_note($sender = 0, $receiver = element('mem_id', $notesendlistuser), $title, $content, 1);
         }
         $member_register_data = array('mem_id' => $mem_id, 'mrg_ip' => $this->input->ip_address(), 'mrg_datetime' => cdate('Y-m-d H:i:s'), 'mrg_useragent' => $this->agent->agent_string(), 'mrg_referer' => $this->session->userdata('site_referer'));
         $recommended = '';
         if ($this->input->post('mem_recommend')) {
             $recommended = $this->Member_model->get_by_userid($this->input->post('mem_recommend'), 'mem_id');
             if (element('mem_id', $recommended)) {
                 $member_register_data['mrg_recommend_mem_id'] = element('mem_id', $recommended);
             } else {
                 $recommended['mem_id'] = 0;
             }
         }
         $this->Member_register_model->insert($member_register_data);
         if ($this->input->post('mem_recommend')) {
             if ($this->cbconfig->item('point_recommended')) {
                 // 추천인이 존재할 경우 추천된 사람
                 $this->point->insert_point(element('mem_id', $recommended), $this->cbconfig->item('point_recommended'), $this->input->post('mem_nickname') . ' 님이 회원가입시 추천함', 'member_recommended', $mem_id, '회원가입추천');
             }
             if ($this->cbconfig->item('point_recommender')) {
                 // 추천인이 존재할 경우 가입자에게
                 $this->point->insert_point($mem_id, $this->cbconfig->item('point_recommender'), '회원가입 추천인존재', 'member_recommender', $mem_id, '회원가입추천인존재');
             }
         }
         $this->session->set_flashdata('nickname', $this->input->post('mem_nickname'));
         if (!$this->cbconfig->item('use_register_email_auth')) {
             $this->session->set_userdata('mem_id', $mem_id);
         }
         redirect('register/result');
     }
 }
Exemplo n.º 25
0
function makePost($post, $type, $params = array())
{
    global $loguser, $loguserid, $usergroups, $isBot, $blocklayouts;
    $poster = getDataPrefix($post, 'u_');
    $post['userlink'] = UserLink($poster);
    LoadBlockLayouts();
    $pltype = Settings::get('postLayoutType');
    $isBlocked = $poster['globalblock'] || $loguser['blocklayouts'] || $post['options'] & 1 || isset($blocklayouts[$poster['id']]);
    $post['type'] = $type;
    $post['formattedDate'] = formatdate($post['date']);
    if (!HasPermission('admin.viewips')) {
        $post['ip'] = '';
    } else {
        $post['ip'] = htmlspecialchars($post['ip']);
    }
    // TODO IP formatting?
    if ($post['deleted'] && $type == POST_NORMAL) {
        $post['deluserlink'] = UserLink(getDataPrefix($post, 'du_'));
        $post['delreason'] = htmlspecialchars($post['reason']);
        $links = array();
        if (HasPermission('mod.deleteposts', $params['fid'])) {
            $links['undelete'] = actionLinkTag(__("Undelete"), "editpost", $post['id'], "delete=2&key=" . $loguser['token']);
            $links['view'] = "<a href=\"#\" onclick=\"replacePost(" . $post['id'] . ",true); return false;\">" . __("View") . "</a>";
        }
        $post['links'] = $links;
        RenderTemplate('postbox_deleted', array('post' => $post));
        return;
    }
    $links = array();
    if ($type != POST_SAMPLE) {
        $forum = $params['fid'];
        $thread = $params['tid'];
        $notclosed = !$post['closed'] || HasPermission('mod.closethreads', $forum);
        $extraLinks = array();
        if (!$isBot) {
            if ($type == POST_DELETED_SNOOP) {
                if ($notclosed && HasPermission('mod.deleteposts', $forum)) {
                    $links['undelete'] = actionLinkTag(__("Undelete"), "editpost", $post['id'], "delete=2&key=" . $loguser['token']);
                }
                $links['close'] = "<a href=\"#\" onclick=\"replacePost(" . $post['id'] . ",false); return false;\">" . __("Close") . "</a>";
            } else {
                if ($type == POST_NORMAL) {
                    if ($notclosed) {
                        if ($loguserid && HasPermission('forum.postreplies', $forum) && !$params['noreplylinks']) {
                            $links['quote'] = actionLinkTag(__("Quote"), "newreply", $thread, "quote=" . $post['id']);
                        }
                        $editrights = 0;
                        if ($poster['id'] == $loguserid && HasPermission('user.editownposts') || HasPermission('mod.editposts', $forum)) {
                            $links['edit'] = actionLinkTag(__("Edit"), "editpost", $post['id']);
                            $editrights++;
                        }
                        if ($poster['id'] == $loguserid && HasPermission('user.deleteownposts') || HasPermission('mod.deleteposts', $forum)) {
                            if ($post['id'] != $post['firstpostid']) {
                                $link = htmlspecialchars(actionLink('editpost', $post['id'], 'delete=1&key=' . $loguser['token']));
                                $onclick = HasPermission('mod.deleteposts', $forum) ? " onclick=\"deletePost(this);return false;\"" : ' onclick="if(!confirm(\'Really delete this post?\'))return false;"';
                                $links['delete'] = "<a href=\"{$link}\"{$onclick}>" . __('Delete') . "</a>";
                            }
                            $editrights++;
                        }
                        if ($editrights < 2 && HasPermission('user.reportposts')) {
                            $links['report'] = actionLinkTag(__('Report'), 'reportpost', $post['id']);
                        }
                    }
                    // plugins should add to $extraLinks
                    $bucket = "topbar";
                    include __DIR__ . "/pluginloader.php";
                }
            }
            $links['extra'] = $extraLinks;
        }
        //Threadlinks for listpost.php
        if ($params['threadlink']) {
            $thread = array();
            $thread['id'] = $post['thread'];
            $thread['title'] = $post['threadname'];
            $thread['forum'] = $post['fid'];
            $post['threadlink'] = makeThreadLink($thread);
        } else {
            $post['threadlink'] = '';
        }
        //Revisions
        if ($post['revision']) {
            $ru_link = UserLink(getDataPrefix($post, "ru_"));
            $revdetail = ' ' . format(__('by {0} on {1}'), $ru_link, formatdate($post['revdate']));
            if (HasPermission('mod.editposts', $forum)) {
                $post['revdetail'] = "<a href=\"javascript:void(0);\" onclick=\"showRevisions(" . $post['id'] . ")\">" . Format(__('rev. {0}'), $post['revision']) . "</a>" . $revdetail;
            } else {
                $post['revdetail'] = Format(__('rev. {0}'), $post['revision']) . $revdetail;
            }
        }
        //</revisions>
    }
    $post['links'] = $links;
    // POST SIDEBAR
    $sidebar = array();
    // quit abusing custom syndromes you unoriginal fuckers
    $poster['title'] = preg_replace('@Affected by \'?.*?Syndrome\'?@si', '', $poster['title']);
    $sidebar['rank'] = GetRank($poster['rankset'], $poster['posts']);
    if ($poster['title']) {
        $sidebar['title'] = strip_tags(CleanUpPost($poster['title'], '', true), '<b><strong><i><em><span><s><del><img><a><br/><br><small>');
    } else {
        $sidebar['title'] = htmlspecialchars($usergroups[$poster['primarygroup']]['title']);
    }
    $sidebar['syndrome'] = GetSyndrome(getActivity($poster['id']));
    if ($post['mood'] > 0) {
        if (file_exists(DATA_DIR . "avatars/" . $poster['id'] . "_" . $post['mood'])) {
            $sidebar['avatar'] = "<img src=\"" . DATA_URL . "avatars/" . $poster['id'] . "_" . $post['mood'] . "\" alt=\"\">";
        }
    } else {
        if ($poster['picture']) {
            $pic = str_replace('$root/', DATA_URL, $poster['picture']);
            $sidebar['avatar'] = "<img src=\"" . htmlspecialchars($pic) . "\" alt=\"\">";
        }
    }
    $lastpost = $poster['lastposttime'] ? timeunits(time() - $poster['lastposttime']) : "none";
    $lastview = timeunits(time() - $poster['lastactivity']);
    if (!$post['num']) {
        $sidebar['posts'] = $poster['posts'];
    } else {
        $sidebar['posts'] = $post['num'] . '/' . $poster['posts'];
    }
    $sidebar['since'] = cdate($loguser['dateformat'], $poster['regdate']);
    $sidebar['lastpost'] = $lastpost;
    $sidebar['lastview'] = $lastview;
    if ($poster['lastactivity'] > time() - 300) {
        $sidebar['isonline'] = __("User is <strong>online</strong>");
    }
    $sidebarExtra = array();
    $bucket = "sidebar";
    include __DIR__ . "/pluginloader.php";
    $sidebar['extra'] = $sidebarExtra;
    $post['sidebar'] = $sidebar;
    // OTHER STUFF
    $post['haslayout'] = false;
    $post['fulllayout'] = false;
    if (!$isBlocked) {
        $poster['postheader'] = $pltype ? trim($poster['postheader']) : '';
        $poster['signature'] = trim($poster['signature']);
        $post['haslayout'] = $poster['postheader'] ? 1 : 0;
        $post['fulllayout'] = $poster['fulllayout'] && $post['haslayout'] && $pltype == 2;
        if (!$post['haslayout'] && $poster['signature']) {
            $poster['signature'] = '<div class="signature">' . $poster['signature'] . '</div>';
        }
    } else {
        $poster['postheader'] = '';
        $poster['signature'] = '';
    }
    $post['contents'] = makePostText($post, $poster);
    //PRINT THE POST!
    RenderTemplate('postbox', array('post' => $post));
}
Exemplo n.º 26
0
    $foo[__("Homepage")] = CleanUpPost($homepage);
}
$profileParts[__("Contact information")] = $foo;
$foo = array();
$foo[__("Theme")] = $themes[$user['theme']];
$foo[__("Items per page")] = Plural($user['postsperpage'], __("post")) . ", " . Plural($user['threadsperpage'], __("thread"));
$profileParts[__("Presentation")] = $foo;
$foo = array();
if ($user['realname']) {
    $foo[__("Real name")] = strip_tags($user['realname']);
}
if ($user['location']) {
    $foo[__("Location")] = strip_tags($user['location']);
}
if ($user['birthday']) {
    $foo[__("Birthday")] = format("{0} ({1} old)", cdate("F j, Y", $user['birthday']), Plural(floor((time() - $user['birthday']) / 86400 / 365.2425), "year"));
}
if ($user['bio']) {
    $foo[__("Bio")] = CleanUpPost($user['bio']);
}
if (count($foo)) {
    $profileParts[__("Personal information")] = $foo;
}
$prepend = "";
$bucket = "profileTable";
include "./lib/pluginloader.php";
write("\n\t<table>\n\t\t<tr>\n\t\t\t<td style=\"width: 60%; border: 0px none; vertical-align: top; padding-right: 1em; padding-bottom: 1em;\">\n\t\t\t\t{0}\n\t\t\t\t<table class=\"outline margin\">\n", $prepend);
$cc = 0;
foreach ($profileParts as $partName => $fields) {
    write("\n\t\t\t\t\t<tr class=\"header0\">\n\t\t\t\t\t\t<th colspan=\"2\">{0}</th>\n\t\t\t\t\t</tr>\n", $partName);
    foreach ($fields as $label => $value) {
Exemplo n.º 27
0
 /**
  * 게시물 복사 밎 이동
  */
 public function post_copy($type = 'copy', $post_id = '')
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_helptool_post_copy';
     $this->load->event($eventname);
     $is_admin = $this->member->is_admin();
     if ($is_admin !== 'super') {
         alert('접근권한이 없습니다');
         return false;
     }
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     $this->load->model(array('Blame_model', 'Board_model', 'Board_group_model', 'Comment_model', 'Like_model', 'Post_extra_vars_model', 'Post_file_model', 'Post_link_model', 'Post_meta_model', 'Scrap_model'));
     $post_id_list = '';
     if ($this->input->post('chk_post_id')) {
         $post_id_list = '';
         $chk_post_id = $this->input->post('chk_post_id');
         foreach ($chk_post_id as $val) {
             if (empty($post_id)) {
                 $post_id = $val;
             }
             $post_id_list .= $val . ',';
         }
     } elseif ($post_id) {
         $post_id_list = $post_id;
     }
     if ($this->input->post('post_id_list')) {
         $post_id_list = $this->input->post('post_id_list');
     }
     $view['view']['post_id_list'] = $post_id_list;
     $post = $this->Post_model->get_one($post_id);
     $board = $this->board->item_all(element('brd_id', $post));
     if ($type !== 'move') {
         $type = 'copy';
     }
     $view['view']['post'] = $post;
     $view['view']['board'] = $board;
     $view['view']['typetext'] = $typetext = $type === 'copy' ? '복사' : '이동';
     $config = array(array('field' => 'is_submit', 'label' => '체크', 'rules' => 'trim'));
     $this->load->library('form_validation');
     $this->form_validation->set_rules($config);
     $form_validation = $this->form_validation->run();
     /**
      * 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
      * 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
      */
     if ($form_validation === false or !$this->input->post('is_submit')) {
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
         $result = $this->Board_model->get_board_list();
         if ($result && is_array($result)) {
             foreach ($result as $key => $value) {
                 $result[$key]['group'] = $this->Board_group_model->get_one(element('bgr_id', $value));
             }
         }
         $view['view']['list'] = $result;
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
         /**
          * 레이아웃을 정의합니다
          */
         $page_title = element('post_title', $post) . ' > 게시물 ' . $typetext;
         $layoutconfig = array('path' => 'helptool', 'layout' => 'layout_popup', 'skin' => 'post_copy', 'layout_dir' => $this->cbconfig->item('layout_helptool'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_helptool'), 'skin_dir' => $this->cbconfig->item('skin_helptool'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_helptool'), 'page_title' => $page_title);
         $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->get_device_view_type());
         $this->data = $view;
         $this->layout = element('layout_skin_file', element('layout', $view));
         $this->view = element('view_skin_file', element('layout', $view));
     } else {
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
         $old_brd_id = element('brd_id', $board);
         $new_brd_id = (int) $this->input->post('chk_brd_id');
         if ($post_id_list) {
             $arr = explode(',', $post_id_list);
             if ($arr) {
                 $arrsize = count($arr);
                 for ($k = $arrsize - 1; $k >= 0; $k--) {
                     $post_id = element($k, $arr);
                     if (empty($post_id)) {
                         continue;
                     }
                     $post = $this->Post_model->get_one($post_id);
                     $board = $this->board->item_all(element('brd_id', $post));
                     if ($type === 'copy') {
                         // 게시글 복사
                         // 이벤트가 존재하면 실행합니다
                         $view['view']['event']['copy_before'] = Events::trigger('copy_before', $eventname);
                         $post_num = $this->Post_model->next_post_num();
                         $post_content = $post['post_content'];
                         if ($this->cbconfig->item('use_copy_log')) {
                             $br = $post['post_html'] ? '<br /><br />' : "\n";
                             $post_content .= $br . '[이 게시물은 ' . $this->member->item('mem_nickname') . ' 님에 의해 ' . cdate('Y-m-d H:i:s') . ' ' . element('brd_name', $board) . ' 에서 복사됨]';
                         }
                         $insertdata = array('post_num' => $post_num, 'post_reply' => $post['post_reply'], 'brd_id' => $new_brd_id, 'post_title' => $post['post_title'], 'post_content' => $post_content, 'mem_id' => $post['mem_id'], 'post_userid' => $post['post_userid'], 'post_username' => $post['post_username'], 'post_nickname' => $post['post_nickname'], 'post_email' => $post['post_email'], 'post_homepage' => $post['post_homepage'], 'post_datetime' => $post['post_datetime'], 'post_password' => $post['post_password'], 'post_updated_datetime' => $post['post_updated_datetime'], 'post_update_mem_id' => $post['post_update_mem_id'], 'post_link_count' => $post['post_link_count'], 'post_secret' => $post['post_secret'], 'post_html' => $post['post_html'], 'post_notice' => $post['post_notice'], 'post_receive_email' => $post['post_receive_email'], 'post_hit' => $post['post_hit'], 'post_ip' => $post['post_ip'], 'post_device' => $post['post_device'], 'post_file' => $post['post_file'], 'post_image' => $post['post_image'], 'post_del' => $post['post_del']);
                         $new_post_id = $this->Post_model->insert($insertdata);
                         $postwhere = array('post_id' => $post_id);
                         $filedata = $this->Post_file_model->get('', '', $postwhere);
                         if ($filedata) {
                             foreach ($filedata as $data) {
                                 $exp = explode('/', $data['pfi_filename']);
                                 $new_file_name = $exp[0] . '/' . $exp['1'] . '/' . random_string('alnum', 30) . '.' . $data['pfi_type'];
                                 $fileinsert = array('post_id' => $new_post_id, 'brd_id' => $new_brd_id, 'mem_id' => $data['mem_id'], 'pfi_originname' => $data['pfi_originname'], 'pfi_filename' => $new_file_name, 'pfi_filesize' => $data['pfi_filesize'], 'pfi_width' => $data['pfi_width'], 'pfi_height' => $data['pfi_height'], 'pfi_type' => $data['pfi_type'], 'pfi_is_image' => $data['pfi_is_image'], 'pfi_datetime' => $data['pfi_datetime'], 'pfi_ip' => $data['pfi_ip']);
                                 $this->Post_file_model->insert($fileinsert);
                                 copy('./uploads/post/' . $data['pfi_filename'], './uploads/post/' . $new_file_name);
                             }
                         }
                         $postwhere = array('post_id' => $post_id);
                         $linkdata = $this->Post_link_model->get('', '', $postwhere);
                         if ($linkdata) {
                             foreach ($linkdata as $data) {
                                 $linkinsert = array('post_id' => $new_post_id, 'brd_id' => $new_brd_id, 'pln_url' => $data['pln_url']);
                                 $this->Post_link_model->insert($linkinsert);
                             }
                         }
                         $postwhere = array('post_id' => $post_id);
                         $metadata = $this->Post_meta_model->get('', '', $postwhere);
                         if ($metadata) {
                             foreach ($metadata as $data) {
                                 $metainsert = array('post_id' => $new_post_id, 'brd_id' => $new_brd_id, 'pmt_key' => $data['pmt_key'], 'pmt_value' => $data['pmt_value']);
                                 $this->Post_meta_model->insert($metainsert);
                             }
                         }
                         // 이벤트가 존재하면 실행합니다
                         $view['view']['event']['copy_after'] = Events::trigger('copy_after', $eventname);
                     }
                     if ($type === 'move') {
                         // 이벤트가 존재하면 실행합니다
                         $view['view']['event']['move_before'] = Events::trigger('move_before', $eventname);
                         // post table update
                         $postupdate = array('brd_id' => $new_brd_id);
                         if ($this->cbconfig->item('use_copy_log')) {
                             $post_content = $post['post_content'];
                             $br = $post['post_html'] ? '<br /><br />' : "\n";
                             $post_content .= $br . '[이 게시물은 ' . $this->member->item('mem_nickname') . ' 님에 의해 ' . cdate('Y-m-d H:i:s') . ' ' . element('brd_name', $board) . ' 에서 이동됨]';
                             $postupdate['post_content'] = $post_content;
                         }
                         $this->Post_model->update($post_id, $postupdate);
                         $dataupdate = array('brd_id' => $new_brd_id);
                         $where = array('target_id' => $post_id, 'target_type' => 1);
                         $this->Blame_model->update('', $dataupdate, $where);
                         $this->Like_model->update('', $dataupdate, $where);
                         $where = array('post_id' => $post_id);
                         $this->Comment_model->update('', $dataupdate, $where);
                         $this->Post_extra_vars_model->update('', $dataupdate, $where);
                         $this->Post_file_model->update('', $dataupdate, $where);
                         $this->Post_link_model->update('', $dataupdate, $where);
                         $this->Post_meta_model->update('', $dataupdate, $where);
                         $this->Scrap_model->update('', $dataupdate, $where);
                         // 이벤트가 존재하면 실행합니다
                         $view['view']['event']['move_after'] = Events::trigger('move_after', $eventname);
                     }
                 }
             }
         }
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['after'] = Events::trigger('after', $eventname);
         $alert = $type === 'copy' ? '게시글 복사가 완료되었습니다' : '게시글 이동이 완료되었습니다';
         alert_close($alert);
     }
 }
Exemplo n.º 28
0
 $rForum = Query($qForum);
 $forum = Fetch($rForum);
 if ($forum['minpower'] > $loguser['powerlevel']) {
     $post['text'] = __("No.");
 }
 LoadBlockLayouts();
 $isBlocked = $blocklayouts[$post['uid']] | $post['globalblock'] | $loguser['blocklayouts'] | $post['options'] & 1;
 $noSmilies = $post['options'] & 2;
 $tags = array();
 $rankHax = $post['posts'];
 if ($post['num'] == "???") {
     $post['num'] = $post['posts'];
 }
 $post['posts'] = $post['num'];
 //Disable tags by commenting/removing this part.
 $tags = array("numposts" => $post['num'], "numdays" => floor((time() - $post['regdate']) / 86400), "date" => cdate($dateformat, $post['date']), "rank" => GetRank($post));
 $bucket = "amperTags";
 include "./lib/pluginloader.php";
 $post['posts'] = $rankHax;
 if ($post['postheader'] && !$isBlocked) {
     $postHeader = str_replace('$theme', $theme, ApplyTags(CleanUpPost($post['postheader']), $tags));
 }
 $postText = ApplyTags(CleanUpPost($post['text'], $post['name'], $noSmilies), $tags);
 $bucket = "postMangler";
 include "./lib/pluginloader.php";
 if ($post['signature'] && !$isBlocked) {
     $postFooter = ApplyTags(CleanUpPost($post['signature']), $tags);
     if (!$post['signsep']) {
         $separator = "<br />_________________________<br />";
     } else {
         $separator = "<br />";
Exemplo n.º 29
0
 /**
  * 파일 업로드 현황을 그래프 형식으로 페이지입니다
  */
 public function graph()
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_admin_board_fileupload_graph';
     $this->load->event($eventname);
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     $param =& $this->querystring;
     $datetype = $this->input->get('datetype', null, 'd');
     if ($datetype !== 'm' && $datetype !== 'y') {
         $datetype = 'd';
     }
     $start_date = $this->input->get('start_date') ? $this->input->get('start_date') : cdate('Y-m-01');
     $end_date = $this->input->get('end_date') ? $this->input->get('end_date') : cdate('Y-m-') . cdate('t');
     $brd_id = $this->input->get('brd_id', null, '');
     $result = $this->{$this->modelname}->get_post_file_by_date($datetype, $start_date, $end_date, $brd_id);
     $sum_count = 0;
     $arr = array();
     $max = 0;
     if ($result && is_array($result)) {
         foreach ($result as $key => $value) {
             $s = element('day', $value);
             if (!isset($arr[$s])) {
                 $arr[$s] = 0;
             }
             $arr[$s] += element('cnt', $value);
             if ($arr[$s] > $max) {
                 $max = $arr[$s];
             }
             $sum_count += element('cnt', $value);
         }
     }
     $view['view']['list'] = array();
     $i = 0;
     $k = 0;
     $save_count = -1;
     $tot_count = 0;
     if (count($arr)) {
         foreach ($arr as $key => $value) {
             $count = (int) $arr[$key];
             $view['view']['list'][$k]['count'] = $count;
             $i++;
             if ($save_count !== $count) {
                 $no = $i;
                 $save_count = $count;
             }
             $view['view']['list'][$k]['no'] = $no;
             $view['view']['list'][$k]['key'] = $key;
             $rate = $count / $sum_count * 100;
             $view['view']['list'][$k]['rate'] = $rate;
             $s_rate = number_format($rate, 1);
             $view['view']['list'][$k]['s_rate'] = $s_rate;
             $bar = (int) ($count / $max * 100);
             $view['view']['list'][$k]['bar'] = $bar;
             $k++;
         }
         $view['view']['max_value'] = $max;
         $view['view']['sum_count'] = $sum_count;
     }
     $view['view']['start_date'] = $start_date;
     $view['view']['end_date'] = $end_date;
     $view['view']['boardlist'] = $this->Board_model->get_board_list();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
     /**
      * 어드민 레이아웃을 정의합니다
      */
     $layoutconfig = array('layout' => 'layout', 'skin' => 'graph');
     $view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
     $this->data = $view;
     $this->layout = element('layout_skin_file', element('layout', $view));
     $this->view = element('view_skin_file', element('layout', $view));
 }
Exemplo n.º 30
0
 /**
  * 검색 페이지 함수입니다
  */
 public function index()
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_search_index';
     $this->load->event($eventname);
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     /**
      * 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
      */
     $param =& $this->querystring;
     $page = (int) $this->input->get('page') > 0 ? (int) $this->input->get('page') : 1;
     $findex = 'post_num, post_reply';
     $sfield = $sfield2 = $this->input->get('sfield', null, '');
     $sop = $this->input->get('sop', null, '');
     if ($sfield === 'post_both') {
         $sfield = array('post_title', 'post_content');
     }
     $mem_id = (int) $this->member->item('mem_id');
     $skeyword = $this->input->get('skeyword', null, '');
     if (empty($skeyword)) {
         // 이벤트가 존재하면 실행합니다
         $view['view']['event']['before_nokeyword_layout'] = Events::trigger('before_nokeyword_layout', $eventname);
         /**
          * 레이아웃을 정의합니다
          */
         $page_title = $this->cbconfig->item('site_meta_title_search');
         $meta_description = $this->cbconfig->item('site_meta_description_search');
         $meta_keywords = $this->cbconfig->item('site_meta_keywords_search');
         $meta_author = $this->cbconfig->item('site_meta_author_search');
         $page_name = $this->cbconfig->item('site_page_name_search');
         $layoutconfig = array('path' => 'search', 'layout' => 'layout', 'skin' => 'search', 'layout_dir' => $this->cbconfig->item('layout_search'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_search'), 'use_sidebar' => $this->cbconfig->item('sidebar_search'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_search'), 'skin_dir' => $this->cbconfig->item('skin_search'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_search'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name);
         $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->get_device_view_type());
         $this->data = $view;
         $this->layout = element('layout_skin_file', element('layout', $view));
         $this->view = element('view_skin_file', element('layout', $view));
         return false;
     }
     /**
      * 게시판 목록에 필요한 정보를 가져옵니다.
      */
     $this->Post_model->allow_search_field = array('post_title', 'post_content', 'post_userid', 'post_nickname');
     // 검색이 가능한 필드
     $this->Post_model->search_field_equal = array('post_userid');
     // 검색중 like 가 아닌 = 검색을 하는 필드
     $per_page = 15;
     $offset = ($page - 1) * $per_page;
     $group_id = (int) $this->input->get('group_id') ? (int) $this->input->get('group_id') : '';
     $board_id = (int) $this->input->get('board_id') ? (int) $this->input->get('board_id') : '';
     $where = array();
     $boardwhere = array('brd_search' => 1);
     if ($group_id) {
         $where['board.bgr_id'] = $group_id;
         $boardwhere['board.bgr_id'] = $group_id;
     }
     $boardlisttmp = $this->Board_model->get_board_list($boardwhere);
     $boardlist = array();
     if (is_array($boardlisttmp)) {
         foreach ($boardlisttmp as $key => $value) {
             $boardlist[$value['brd_id']] = $value;
         }
     }
     $grouplisttmp = $this->Board_group_model->get('', '', '', '', 0, 'bgr_order', 'ASC');
     if (is_array($grouplisttmp)) {
         foreach ($grouplisttmp as $key => $value) {
             $grouplist[$value['bgr_id']] = $value;
         }
     }
     $where['post.post_secret'] = 0;
     $where['post.post_del'] = 0;
     $like = '';
     $result = $this->Post_model->get_search_list($per_page, $offset, $where, $like, $board_id, $findex, $sfield, $skeyword, $sop);
     $list_num = $result['total_rows'] - ($page - 1) * $per_page;
     if (element('list', $result)) {
         foreach (element('list', $result) as $key => $val) {
             $images = '';
             if (element('post_image', $val)) {
                 $imagewhere = array('post_id' => element('post_id', $val), 'pfi_is_image' => 1);
                 $images = $this->Post_file_model->get_one('', '', $imagewhere, '', '', 'pfi_id', 'ASC');
             }
             $result['list'][$key]['images'] = $images;
             $result['list'][$key]['post_url'] = post_url(element('brd_key', $val), element('post_id', $val));
             $result['list'][$key]['display_name'] = display_username(element('post_userid', $val), element('post_nickname', $val), element('mem_icon', $val), 'Y');
             $result['list'][$key]['display_datetime'] = display_datetime(element('post_datetime', $val), 'user', 'Y-m-d H:i');
             $result['list'][$key]['content'] = cut_str(strip_tags(element('post_content', $val)), 200);
             $result['list'][$key]['is_mobile'] = element('post_device', $val) === 'mobile' ? true : false;
         }
     }
     $view['view']['data'] = $result;
     $view['view']['boardlist'] = $boardlist;
     $view['view']['grouplist'] = $grouplist;
     if (!$this->session->userdata('skeyword_' . urlencode($skeyword))) {
         $sfieldarray = array('post_title', 'post_content', 'post_both');
         if (in_array($sfield2, $sfieldarray)) {
             $searchinsert = array('sek_keyword' => $skeyword, 'sek_datetime' => cdate('Y-m-d H:i:s'), 'sek_ip' => $this->input->ip_address(), 'mem_id' => $mem_id);
             $this->Search_keyword_model->insert($searchinsert);
             $this->session->set_userdata('skeyword_' . urlencode($skeyword), 1);
         }
     }
     $highlight_keyword = '';
     if ($skeyword) {
         $key_explode = explode(' ', $skeyword);
         if ($key_explode) {
             foreach ($key_explode as $seval) {
                 if ($highlight_keyword) {
                     $highlight_keyword .= ',';
                 }
                 $highlight_keyword .= '\'' . html_escape($seval) . '\'';
             }
         }
     }
     $view['view']['highlight_keyword'] = $highlight_keyword;
     /**
      * primary key 정보를 저장합니다
      */
     $view['view']['primary_key'] = $this->Post_model->primary_key;
     /**
      * 페이지네이션을 생성합니다
      */
     $config['base_url'] = site_url('search/') . '?' . $param->replace('page');
     $view['view']['tab_url'] = site_url('search/') . '?' . $param->replace('page, board_id');
     $config['total_rows'] = $result['total_rows'];
     $config['per_page'] = $per_page;
     if ($this->cbconfig->get_device_view_type() === 'mobile') {
         $config['num_links'] = 3;
     } else {
         $config['num_links'] = 5;
     }
     $this->pagination->initialize($config);
     $view['view']['paging'] = $this->pagination->create_links();
     $view['view']['page'] = $page;
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
     /**
      * 레이아웃을 정의합니다
      */
     $page_title = $this->cbconfig->item('site_meta_title_search');
     $meta_description = $this->cbconfig->item('site_meta_description_search');
     $meta_keywords = $this->cbconfig->item('site_meta_keywords_search');
     $meta_author = $this->cbconfig->item('site_meta_author_search');
     $page_name = $this->cbconfig->item('site_page_name_search');
     $searchconfig = array('{검색어}');
     $replaceconfig = array($skeyword);
     $page_title = str_replace($searchconfig, $replaceconfig, $page_title);
     $meta_description = str_replace($searchconfig, $replaceconfig, $meta_description);
     $meta_keywords = str_replace($searchconfig, $replaceconfig, $meta_keywords);
     $meta_author = str_replace($searchconfig, $replaceconfig, $meta_author);
     $page_name = str_replace($searchconfig, $replaceconfig, $page_name);
     $layoutconfig = array('path' => 'search', 'layout' => 'layout', 'skin' => 'search', 'layout_dir' => $this->cbconfig->item('layout_search'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_search'), 'use_sidebar' => $this->cbconfig->item('sidebar_search'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_search'), 'skin_dir' => $this->cbconfig->item('skin_search'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_search'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name);
     $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->get_device_view_type());
     $this->data = $view;
     $this->layout = element('layout_skin_file', element('layout', $view));
     $this->view = element('view_skin_file', element('layout', $view));
 }