本文整理汇总了PHP中fn_get_page_data函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_page_data函数的具体用法?PHP fn_get_page_data怎么用?PHP fn_get_page_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_get_page_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($id = 0, $params = array())
{
$lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
if (!empty($id)) {
$data = fn_get_page_data($id, $lang_code, false, $this->area);
if ($data) {
$status = Response::STATUS_OK;
} else {
$status = Response::STATUS_NOT_FOUND;
}
} else {
$items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_pages_per_page'));
if (empty($params['page_type'])) {
$params['full_search'] = true;
}
list($pages, $search) = fn_get_pages($params, $items_per_page, $lang_code);
$data = array('pages' => array_values($pages), 'params' => $search);
$status = Response::STATUS_OK;
}
return array('status' => $status, 'data' => $data);
}
示例2: fn_is_accessible_discussion
function fn_is_accessible_discussion($data, &$auth)
{
$access = false;
if ($data['object_type'] == 'P') {
//product
$access = fn_get_product_data($data['object_id'], $auth, CART_LANGUAGE, $field_list = '?:products.product_id', false, false, false);
} elseif ($data['object_type'] == 'C') {
//category
$access = fn_get_category_data($data['object_id'], '', $field_list = '?:categories.category_id', false);
} elseif ($data['object_type'] == 'M') {
//company
$access = fn_get_company_data($data['object_id']);
} elseif ($data['object_type'] == 'O') {
//order
if (!empty($auth['user_id'])) {
$access = db_get_field("SELECT order_id FROM ?:orders WHERE order_id = ?i AND user_id = ?i", $data['object_id'], $auth['user_id']);
} elseif (!empty($auth['order_ids'])) {
$access = in_array($data['object_id'], $auth['order_ids']);
}
} elseif ($data['object_type'] == 'A') {
// page
$access = fn_get_page_data($data['object_id'], CART_LANGUAGE);
} elseif ($data['object_type'] == 'E') {
// testimonials
$access = true;
}
fn_set_hook('is_accessible_discussion', $data, $auth, $access);
return !empty($access);
}
示例3: fn_save_post_data
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($mode == 'send_form') {
$suffix = '';
if (fn_image_verification('use_for_form_builder', $_REQUEST) == false) {
fn_save_post_data('form_values');
return array(CONTROLLER_STATUS_REDIRECT, "pages.view?page_id={$_REQUEST['page_id']}");
}
if (fn_send_form($_REQUEST['page_id'], empty($_REQUEST['form_values']) ? array() : $_REQUEST['form_values'])) {
$suffix = '&sent=Y';
}
return array(CONTROLLER_STATUS_OK, "pages.view?page_id={$_REQUEST['page_id']}" . $suffix);
}
return;
}
if ($mode == 'view' && !empty($_REQUEST['page_id'])) {
$page_is_https = db_get_field("SELECT value FROM ?:form_options WHERE element_type = ?s AND page_id = ?i", FORM_IS_SECURE, $_REQUEST['page_id']);
// if form is secure, redirect to https connection
if (!defined('HTTPS') && $page_is_https == 'Y') {
return array(CONTROLLER_STATUS_REDIRECT, Registry::get('config.https_location') . '/' . Registry::get('config.current_url'));
} elseif (defined('HTTPS') && Registry::get('settings.Security.keep_https') != 'Y' && $page_is_https != 'Y') {
return array(CONTROLLER_STATUS_REDIRECT, Registry::get('config.http_location') . '/' . Registry::get('config.current_url'));
}
$restored_form_values = fn_restore_post_data('form_values');
if (!empty($restored_form_values)) {
Registry::get('view')->assign('form_values', $restored_form_values);
}
} elseif ($mode == 'sent' && !empty($_REQUEST['page_id'])) {
$page = fn_get_page_data($_REQUEST['page_id'], CART_LANGUAGE);
Registry::get('view')->assign('page', $page);
}
示例4: die
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
return;
}
//
// View page details
//
if ($mode == 'view') {
$_REQUEST['page_id'] = empty($_REQUEST['page_id']) ? 0 : $_REQUEST['page_id'];
$preview = fn_is_preview_action($auth, $_REQUEST);
$page = fn_get_page_data($_REQUEST['page_id'], CART_LANGUAGE, $preview);
if (empty($page) || $page['status'] == 'D' && !$preview) {
return array(CONTROLLER_STATUS_NO_PAGE);
}
if (!empty($page['meta_description']) || !empty($page['meta_keywords'])) {
Registry::get('view')->assign('meta_description', $page['meta_description']);
Registry::get('view')->assign('meta_keywords', $page['meta_keywords']);
}
// If page title for this page is exist than assign it to template
if (!empty($page['page_title'])) {
Registry::get('view')->assign('page_title', $page['page_title']);
}
$parent_ids = explode('/', $page['id_path']);
foreach ($parent_ids as $p_id) {
$_page = fn_get_page_data($p_id);
fn_add_breadcrumb($_page['page'], $p_id == $page['page_id'] ? '' : ($_page['page_type'] == PAGE_TYPE_LINK && !empty($_page['link']) ? $_page['link'] : "pages.view?page_id={$p_id}"));
}
Registry::get('view')->assign('page', $page);
}
示例5: fn_top_menu_form
/**
* Form top menu
*
* @param array $top_menu top menu data from the database
* @param int $level current menu level
* @param boolean $active - menu item active flag, returned by reference to set tree branch as active
* @return array formed top menu
*/
function fn_top_menu_form($top_menu, $level = 0, &$active = NULL)
{
$_active = false;
foreach ($top_menu as $k => $v) {
if (!empty($v['param_3'])) {
// get extra items
list($type, $id, $use_name) = fn_explode(':', $v['param_3']);
if ($type == 'C') {
// categories
$cats = fn_get_categories_tree($id, true);
$v['subitems'] = fn_array_merge(fn_top_menu_standardize($cats, 'category_id', 'category', 'subcategories', 'categories.view?category_id='), !empty($v['subitems']) ? $v['subitems'] : array(), false);
if ($use_name == 'Y' && !empty($id)) {
$v['descr'] = fn_get_category_name($id);
$v['param'] = 'categories.view?category_id=' . $id;
}
} elseif ($type == 'A') {
// pages
$params = array('from_page_id' => $id, 'get_tree' => 'multi_level', 'status' => 'A');
list($pages) = fn_get_pages($params);
$v['subitems'] = fn_array_merge(fn_top_menu_standardize($pages, 'page_id', 'page', 'subpages', 'pages.view?page_id='), !empty($v['subitems']) ? $v['subitems'] : array(), false);
if ($use_name == 'Y' && !empty($id)) {
$page_data = fn_get_page_data($id);
$v['descr'] = $page_data['page'];
$v['param'] = !empty($page_data['link']) ? $page_data['link'] : 'pages.view?page_id=' . $id;
}
} else {
// for addons
fn_set_hook('top_menu_form', $v, $type, $id, $use_name);
}
}
if (!empty($v['param']) && fn_top_menu_is_current_url($v['param'], $v['param_2'])) {
$top_menu[$k]['active'] = true;
// Store active value
$_active = true;
}
if (!empty($v['subitems'])) {
$top_menu[$k]['subitems'] = fn_top_menu_form($v['subitems'], $level + 1, $active);
// If active status was returned fron children
if ($active) {
$top_menu[$k]['active'] = $active;
// Strore fo return and reset activity status for athother elements on this level
// Because in one level may be only one active item
$_active = true;
$active = false;
}
}
$top_menu[$k]['item'] = $v['descr'];
$top_menu[$k]['href'] = $v['param'];
$top_menu[$k]['level'] = $level;
unset($top_menu[$k]['descr'], $top_menu[$k]['param']);
}
$active = $_active;
return $top_menu;
}
示例6: fn_twg_api_get_page
/**
* Get user info
* @param int $page_id
*/
function fn_twg_api_get_page($page_id)
{
if (!$page_id) {
return false;
}
$page = fn_get_page_data($page_id);
if (!$page) {
return false;
}
return Api::getAsApiObject('page', $page);
}
示例7: fn_top_menu_form
/**
* Form top menu
*
* @param array $top_menu Top menu data from the database
* @param int $level Current menu level
* @param boolean $active Menu item active flag, returned by reference to set tree branch as active
*
* @return array Formed top menu
*/
function fn_top_menu_form($top_menu, $level = 0, &$active = NULL)
{
/**
* Modifies top menu forming parameters
*
* @param array $top_menu Top menu data from the database
* @param int $level Current menu level
* @param boolean $active Menu item active flag
*/
fn_set_hook('top_menu_form_pre', $top_menu, $level, $active);
$_active = false;
foreach ($top_menu as $k => $v) {
if (!empty($v['param_3'])) {
// get extra items
list($type, $id, $use_name) = fn_explode(':', $v['param_3']);
if ($type == 'C') {
// categories
$cats = fn_get_categories_tree($id, true);
$v['subitems'] = fn_array_merge(fn_top_menu_standardize($cats, 'category_id', 'category', 'subcategories', 'categories.view?category_id='), !empty($v['subitems']) ? $v['subitems'] : array(), false);
if ($use_name == 'Y' && !empty($id)) {
$v['descr'] = fn_get_category_name($id);
$v['param'] = 'categories.view?category_id=' . $id;
}
//Should add this checking because the same pages can have different request parameters and the next checking
//with fn_top_menu_is_current_url function could return incorrect result.
//For example: categories.view?category_id=165 and categories.view?category_id=165¤cy=EUR should have the same active elements.
if (fn_check_is_active_menu_item(array('category_id' => $id), 'categories')) {
$top_menu[$k]['active'] = true;
}
} elseif ($type == 'A') {
// pages
$params = array('from_page_id' => $id, 'get_tree' => 'multi_level', 'status' => 'A');
list($pages) = fn_get_pages($params);
$v['subitems'] = fn_array_merge(fn_top_menu_standardize($pages, 'page_id', 'page', 'subpages', 'pages.view?page_id='), !empty($v['subitems']) ? $v['subitems'] : array(), false);
if ($use_name == 'Y' && !empty($id)) {
$page_data = fn_get_page_data($id);
$v['descr'] = $page_data['page'];
$v['param'] = !empty($page_data['link']) ? $page_data['link'] : 'pages.view?page_id=' . $id;
}
if (fn_check_is_active_menu_item(array('page_id' => $id), 'pages')) {
$top_menu[$k]['active'] = true;
}
} else {
// for addons
/**
* Deprecated since 4.3.6, use top_menu_form_post instead
*/
fn_set_hook('top_menu_form', $v, $type, $id, $use_name);
}
}
if (!empty($v['param']) && fn_top_menu_is_current_url($v['param'], $v['param_2'])) {
$top_menu[$k]['active'] = true;
// Store active value
$_active = true;
}
if (!empty($v['subitems'])) {
$top_menu[$k]['subitems'] = fn_top_menu_form($v['subitems'], $level + 1, $active);
// If active status was returned fron children
if ($active) {
$top_menu[$k]['active'] = $active;
// Strore fo return and reset activity status for athother elements on this level
// Because in one level may be only one active item
$_active = true;
$active = false;
}
}
$top_menu[$k]['item'] = $v['descr'];
$top_menu[$k]['href'] = $v['param'];
$top_menu[$k]['level'] = $level;
unset($top_menu[$k]['descr'], $top_menu[$k]['param']);
}
$active = $_active;
/**
* Modifies top menu items
*
* @param array $top_menu Top menu data from the database
* @param int $level Current menu level
* @param boolean $active Menu item active flag
*/
fn_set_hook('top_menu_form_post', $top_menu, $level, $active);
return $top_menu;
}
示例8: array
Registry::set('navigation.tabs.poll', array('title' => __('poll'), 'js' => true));
}
} elseif ($mode == 'update') {
$page_data = Tygh::$app['view']->getTemplateVars('page_data');
if ($page_data['page_type'] == PAGE_TYPE_POLL) {
Registry::set('navigation.tabs.poll', array('title' => __('poll'), 'js' => true));
Registry::set('navigation.tabs.poll_questions', array('title' => __('questions'), 'js' => true));
Registry::set('navigation.tabs.poll_statistics', array('title' => __('poll_statistics'), 'js' => true));
$questions = db_get_array("SELECT q.*, d.description FROM ?:poll_items as q LEFT JOIN ?:poll_descriptions as d ON d.object_id = q.item_id AND d.type = 'I' AND d.lang_code = ?s WHERE q.parent_id = ?i AND q.type IN ('Q', 'M', 'T')", DESCR_SL, $_REQUEST['page_id']);
Tygh::$app['view']->assign('questions', $questions);
}
} elseif ($mode == 'update_question') {
$question_data = db_get_row("SELECT q.*, d.description FROM ?:poll_items as q LEFT JOIN ?:poll_descriptions as d ON d.object_id = q.item_id AND d.type = 'I' AND d.lang_code = ?s WHERE q.item_id = ?i", DESCR_SL, $_REQUEST['item_id']);
$question_data['answers'] = db_get_array("SELECT q.*, d.description FROM ?:poll_items as q LEFT JOIN ?:poll_descriptions as d ON d.object_id = q.item_id AND d.type = 'I' AND d.lang_code = ?s WHERE q.parent_id = ?i ORDER BY q.position", DESCR_SL, $_REQUEST['item_id']);
Tygh::$app['view']->assign('question_data', $question_data);
$page_data = fn_get_page_data($question_data['page_id']);
Tygh::$app['view']->assign('page_data', $page_data);
} elseif ($mode == 'picker' && !empty($_REQUEST['picker_for']) && $_REQUEST['picker_for'] == 'polls') {
Tygh::$app['view']->assign('button_names', array('but_close_text' => __('add_polls_and_close'), 'but_text' => __('add_polls')));
}
function fn_polls_update_question($data, $item_id, $page_id, $lang_code = DESCR_SL)
{
// question type
$question_type = $data['type'];
// Update questions
if (!empty($item_id)) {
db_query("UPDATE ?:poll_items SET ?u WHERE item_id = ?i", $data, $item_id);
unset($data['type']);
db_query("UPDATE ?:poll_descriptions SET ?u WHERE object_id = ?i AND type = 'I' AND lang_code = ?s", $data, $item_id, $lang_code);
} else {
$data['parent_id'] = $page_id;
示例9: list
if ($page_type == PAGE_TYPE_LINK) {
Registry::set('navigation.selected_tab', 'content');
Registry::set('navigation.subsection', 'links');
}
list($pages_tree, $params) = fn_get_pages(array('get_tree' => 'plain'));
$view->assign('all_pages_list', $pages_tree);
$view->assign('page_type', $page_type);
$view->assign('page_type_data', fn_get_page_object_by_type($page_type));
$view->assign('companies', fn_get_short_companies());
//
// 'page update' page
//
} elseif ($mode == 'update') {
Registry::set('navigation.tabs', array('basic' => array('title' => fn_get_lang_var('general'), 'js' => true), 'blocks' => array('title' => fn_get_lang_var('blocks'), 'js' => true), 'addons' => array('title' => fn_get_lang_var('addons'), 'js' => true)));
// Get current page data
$page_data = fn_get_page_data($page_id, DESCR_SL);
if (!$page_data) {
return array(CONTROLLER_STATUS_NO_PAGE);
}
// [Breadcrumbs]
fn_add_breadcrumb(fn_get_lang_var('pages'), "pages.manage&get_tree=multi_level");
// [/Breadcrumbs]
if ($page_data['page_type'] == PAGE_TYPE_LINK) {
Registry::set('navigation.selected_tab', 'content');
Registry::set('navigation.subsection', 'links');
}
// [Block manager]
list($blocks) = fn_get_blocks(array('location' => 'pages', 'block_type' => 'B', 'all' => true));
if (!empty($blocks)) {
$view->assign('blocks', $blocks);
$view->assign('selected_block', fn_get_selected_block_data($_REQUEST, $blocks, $_REQUEST['page_id'], 'pages'));
示例10: fn_get_page_object_by_type
Registry::get('view')->assign('search', $params);
Registry::get('view')->assign('page_types', fn_get_page_object_by_type());
if (!empty($_REQUEST['except_id'])) {
Registry::get('view')->assign('except_id', $_REQUEST['except_id']);
}
if ($mode == 'picker') {
if (!empty($_REQUEST['combination_suffix'])) {
Registry::get('view')->assign('combination_suffix', $_REQUEST['combination_suffix']);
}
Registry::get('view')->display('pickers/pages/picker_contents.tpl');
exit;
}
} elseif ($mode == 'get_parent_pages') {
$page_data = array();
if (isset($_REQUEST['page_id'])) {
Registry::get('view')->assign('page_id', $_REQUEST['page_id']);
$page_data = fn_get_page_data($_REQUEST['page_id'], DESCR_SL);
} else {
Registry::get('view')->assign('show_all', true);
}
if (!empty($_REQUEST['parent_id'])) {
$page_data['parent_id'] = $_REQUEST['parent_id'];
}
Registry::get('view')->assign('page_data', $page_data);
Registry::get('view')->assign('parent_pages', fn_get_pages_plain_list());
Registry::get('view')->display('views/pages/components/parent_page_selector.tpl');
exit;
}
Registry::get('view')->assign('usergroups', fn_get_usergroups('C', DESCR_SL));
/* /Preparing page data for templates and performing simple actions*/
/** /Body **/
示例11: die
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
return;
}
if ($mode == 'add' || $mode == 'update') {
$page_type = isset($_REQUEST['page_type']) ? $_REQUEST['page_type'] : '';
if (empty($page_type) && !empty($_REQUEST['page_id'])) {
$page_data = fn_get_page_data($_REQUEST['page_id']);
$page_type = $page_data['page_type'];
}
if ($page_type == PAGE_TYPE_FORM) {
// [Page sections]
Registry::set('navigation.tabs.build_form', array('title' => __('form_builder'), 'js' => true));
// [/Page sections]
}
Registry::get('view')->assign('selectable_elements', implode('', fn_form_builder_selectable_elements()));
}
if ($mode == 'update') {
list($elements, $form) = fn_get_form_elements($_REQUEST['page_id'], false, DESCR_SL);
Registry::get('view')->assign('form', $form);
Registry::get('view')->assign('elements', $elements);
}
示例12: fn_send_form
function fn_send_form($page_id, $form_values)
{
$result = false;
if (!empty($form_values)) {
$page_data = fn_get_page_data($page_id);
if (!empty($page_data['form']['elements'])) {
$result = true;
$attachments = array();
$fb_files = fn_filter_uploaded_data('fb_files');
if (!empty($fb_files)) {
foreach ($fb_files as $k => $v) {
$attachments[$v['name']] = $v['path'];
$form_values[$k] = $v['name'];
}
}
$max_length = 0;
$sender = '';
foreach ($page_data['form']['elements'] as $k => $v) {
if (($l = strlen($v['description'])) > $max_length) {
$max_length = $l;
}
// Check if sender email exists
if ($v['element_type'] == FORM_EMAIL) {
$sender = $form_values[$k];
}
if ($v['element_type'] == FORM_DATE) {
$form_values[$k] = fn_parse_date($form_values[$k]);
}
if ($v['element_type'] == FORM_REFERER) {
$form_values[$k] = $_SESSION['auth']['referer'];
}
if ($v['element_type'] == FORM_IP_ADDRESS) {
$ip = fn_get_ip();
$form_values[$k] = $ip['host'];
}
}
$max_length += 2;
if ($result == true) {
$from = 'default_company_support_department';
$is_html = true;
fn_set_hook('send_form', $page_data, $form_values, $result, $from, $sender, $attachments, $is_html);
if ($result == true) {
Mailer::sendMail(array('to' => $page_data['form']['general'][FORM_RECIPIENT], 'from' => $from, 'reply_to' => $sender, 'data' => array('max_length' => $max_length, 'elements' => $page_data['form']['elements'], 'form_title' => $page_data['page'], 'form_values' => $form_values), 'attachments' => $attachments, 'tpl' => 'addons/form_builder/form.tpl', 'is_html' => $is_html), 'A');
}
}
}
}
return $result;
}
示例13: fn_send_form
function fn_send_form($page_id, $form_values)
{
if (!empty($form_values)) {
$page_data = fn_get_page_data($page_id);
if (empty($page_data['form']['elements'])) {
return false;
}
$attachments = array();
$fb_files = fn_filter_uploaded_data('fb_files');
if (!empty($fb_files)) {
foreach ($fb_files as $k => $v) {
$attachments[$v['name']] = $v['path'];
$form_values[$k] = $v['name'];
}
}
$max_length = 0;
$sender = '';
foreach ($page_data['form']['elements'] as $k => $v) {
if (($l = strlen($v['description'])) > $max_length) {
$max_length = $l;
}
if ($v['element_type'] == FORM_EMAIL_CONFIRM) {
if (!is_array($form_values[$k]) || $form_values[$k][0] != $form_values[$k][1] || empty($form_values[$k][0]) || $form_values[$k][1]) {
return false;
}
$form_values[$k] = $form_values[$k][0];
}
// Check if sender email exists
if ($v['element_type'] == FORM_EMAIL || $v['element_type'] == FORM_EMAIL_CONFIRM) {
$sender = $form_values[$k];
}
if ($v['element_type'] == FORM_DATE) {
$form_values[$k] = fn_parse_date($form_values[$k]);
}
if ($v['element_type'] == FORM_REFERER) {
$form_values[$k] = $_SESSION['auth']['referer'];
}
if ($v['element_type'] == FORM_IP_ADDRESS) {
$ip = fn_get_ip();
$form_values[$k] = $ip['host'];
}
}
$max_length += 2;
fn_set_hook('send_form', $page_data, $form_values);
Registry::get('view_mail')->assign('max_length', $max_length);
Registry::get('view_mail')->assign('elements', $page_data['form']['elements']);
Registry::get('view_mail')->assign('form_title', $page_data['page']);
Registry::get('view_mail')->assign('form_values', $form_values);
fn_send_mail($page_data['form']['general'][FORM_RECIPIENT], Registry::get('settings.Company.company_support_department'), 'addons/form_builder/form_subject.tpl', 'addons/form_builder/form_body.tpl', $attachments, CART_LANGUAGE, $sender);
}
return false;
}
示例14: fn_set_page_company_id
function fn_set_page_company_id($page_data, $lang_code)
{
if ($page_data['parent_id'] != 0) {
$parent_page_data = fn_get_page_data($page_data['parent_id'], $lang_code);
$company_id = $parent_page_data['company_id'];
} else {
$company_id = Registry::ifGet('runtime.company_id', $page_data['company_id']);
}
return $company_id;
}
示例15: fn_set_page_company_id
function fn_set_page_company_id($page_data, $lang_code)
{
if (isset($page_data['parent_id']) && $page_data['parent_id'] != 0) {
$parent_page_data = fn_get_page_data($page_data['parent_id'], $lang_code);
$company_id = $parent_page_data['company_id'];
} elseif ($_company_id = Registry::get('runtime.company_id')) {
$company_id = $_company_id;
} else {
$company_id = isset($page_data['company_id']) ? $page_data['company_id'] : 0;
}
return $company_id;
}