当前位置: 首页>>代码示例>>PHP>>正文


PHP has_submit_permission函数代码示例

本文整理汇总了PHP中has_submit_permission函数的典型用法代码示例。如果您正苦于以下问题:PHP has_submit_permission函数的具体用法?PHP has_submit_permission怎么用?PHP has_submit_permission使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了has_submit_permission函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: info

 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'download_downloads';
     $info['date_field'] = 'add_date';
     $info['id_field'] = 'id';
     $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_downloads') ? build_url(array('page' => 'cms_downloads', 'type' => 'ad'), get_module_zone('cms_downloads')) : new ocp_tempcode();
     $info['category_field'] = 'category_id';
     $info['category_type'] = 'downloads';
     $info['parent_spec__table_name'] = 'download_categories';
     $info['parent_spec__parent_name'] = 'parent_id';
     $info['parent_spec__field_name'] = 'id';
     $info['parent_field_name'] = 'id';
     $info['submitter_field'] = 'submitter';
     $info['id_is_string'] = false;
     require_lang('downloads');
     $info['title'] = do_lang_tempcode('SECTION_DOWNLOADS');
     $info['validated_field'] = 'validated';
     $info['category_is_string'] = false;
     $info['archive_url'] = build_url(array('page' => 'downloads'), get_module_zone('downloads'));
     $info['cms_page'] = 'cms_downloads';
     $info['views_field'] = 'download_views';
     $info['supports_custom_fields'] = true;
     return $info;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:download.php

示例2: info

 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'videos';
     $info['date_field'] = 'add_date';
     $info['id_field'] = 'id';
     $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_galleries') ? build_url(array('page' => 'cms_galleries', 'type' => 'av'), get_module_zone('cms_galleries')) : new ocp_tempcode();
     $info['category_field'] = 'cat';
     $info['category_type'] = 'galleries';
     $info['parent_spec__table_name'] = 'galleries';
     $info['parent_spec__parent_name'] = 'parent_id';
     $info['parent_spec__field_name'] = 'name';
     $info['parent_field_name'] = 'cat';
     $info['submitter_field'] = 'submitter';
     $info['id_is_string'] = false;
     require_lang('galleries');
     $info['title'] = do_lang_tempcode('VIDEOS');
     $info['validated_field'] = 'validated';
     $info['category_is_string'] = true;
     $info['archive_url'] = build_url(array('page' => 'galleries'), get_module_zone('galleries'));
     $info['cms_page'] = 'cms_galleries';
     $info['where'] = 'cat NOT LIKE \'' . db_encode_like('download\\_%') . '\'';
     $info['views_field'] = 'video_views';
     $info['supports_custom_fields'] = true;
     return $info;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:32,代码来源:video.php

示例3: info

 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @param  ?ID_TEXT	Catalogue we'll be using (NULL: unknown).
  * @return ?array		Map of award content-type info (NULL: disabled).
  */
 function info($catalogue_name = NULL)
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'catalogue_entries';
     $info['date_field'] = 'ce_add_date';
     $info['id_field'] = 'id';
     $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues') ? build_url(array('page' => 'cms_catalogues', 'type' => 'add_entry', 'catalogue_name' => $catalogue_name), get_module_zone('cms_catalogues')) : new ocp_tempcode();
     $info['category_field'] = array('c_name', 'cc_id');
     $info['category_type'] = array('catalogues_catalogue', 'catalogues_category');
     $info['parent_spec__table_name'] = 'catalogue_categories';
     $info['parent_spec__parent_name'] = 'cc_parent_id';
     $info['parent_spec__field_name'] = 'id';
     $info['parent_field_name'] = 'cc_id';
     $info['submitter_field'] = 'ce_submitter';
     $info['id_is_string'] = false;
     require_lang('catalogues');
     $info['title'] = do_lang_tempcode('CATALOGUE_ENTRIES');
     $info['validated_field'] = 'ce_validated';
     $info['category_is_string'] = array(true, false);
     $info['archive_url'] = build_url(array('page' => 'catalogues'), get_module_zone('catalogues'));
     $info['cms_page'] = 'cms_catalogues';
     $info['views_field'] = 'ce_views';
     return $info;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:catalogue_entry.php

示例4: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_code('catalogues');
     require_lang('catalogues');
     require_css('catalogues');
     $number = array_key_exists('param', $map) ? intval($map['param']) : 10;
     $catalogue = array_key_exists('catalogue', $map) ? $map['catalogue'] : 'faqs';
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('catalogues');
     $root = array_key_exists('root', $map) && $map['root'] != '' ? intval($map['root']) : NULL;
     $catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $catalogue), '', 1);
     if (!array_key_exists(0, $catalogues)) {
         return do_lang_tempcode('MISSING_RESOURCE', escape_html($catalogue));
     }
     $catalogue_row = $catalogues[0];
     $entries = $GLOBALS['SITE_DB']->query_select('catalogue_entries', array('*'), array('c_name' => $catalogue, 'ce_validated' => 1), 'ORDER BY ce_add_date DESC', $number);
     $tpl_set = $catalogue;
     $display_type = array_key_exists('display_type', $map) ? intval($map['display_type']) : NULL;
     list($content, , ) = get_catalogue_category_entry_buildup(db_get_first_id(), $catalogue, $catalogue_row, 'SEARCH', $tpl_set, $number, 0, NULL, $root, $display_type, false, $entries);
     $catalogue_title = get_translated_text($catalogue_row['c_title']);
     if ($content->is_empty()) {
         if (has_actual_page_access(NULL, 'cms_catalogues', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues')) {
             $submit_url = build_url(array('page' => 'cms_catalogues', 'type' => 'add_entry', 'catalogue_name' => $catalogue, 'redirect' => SELF_REDIRECT), get_module_zone('cms_catalogues'));
         } else {
             $submit_url = new ocp_tempcode();
         }
         return do_template('BLOCK_NO_ENTRIES', array('HIGH' => false, 'TITLE' => do_lang_tempcode('RECENT', escape_html(integer_format($number)), escape_html($catalogue_title)), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('CATALOGUE_GENERIC_ADD', escape_html($catalogue_title)), 'SUBMIT_URL' => $submit_url));
     }
     return do_template('BLOCK_MAIN_RECENT_CC_ENTRIES', array('_GUID' => 'a57fa1b83d1b6fe3acbceb2b618e6d7f', 'CATALOGUE_TITLE' => $catalogue_title, 'CATALOGUE' => $catalogue, 'CONTENT' => $content, 'NUMBER' => integer_format($number)));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:35,代码来源:main_recent_cc_entries.php

示例5: info

 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'seedy_posts';
     $info['date_field'] = 'date_and_time';
     $info['id_field'] = 'id';
     $info['add_url'] = has_submit_permission('low', get_member(), get_ip_address(), 'cedi') ? build_url(array('page' => 'cedi', 'type' => 'add_post'), get_module_zone('cedi')) : new ocp_tempcode();
     $info['category_field'] = 'page_id';
     $info['category_type'] = 'seedy_page';
     $info['parent_spec__table_name'] = 'seedy_children';
     $info['parent_spec__parent_name'] = 'parent_id';
     $info['parent_spec__field_name'] = 'child_id';
     $info['parent_field_name'] = 'page_id';
     $info['submitter_field'] = 'the_user';
     $info['id_is_string'] = false;
     require_lang('cedi');
     $info['title'] = do_lang_tempcode('CEDI_POSTS');
     $info['validated_field'] = 'validated';
     $info['category_is_string'] = false;
     $info['archive_url'] = build_url(array('page' => 'cedi'), get_module_zone('cedi'));
     $info['cms_page'] = 'cedi';
     $info['supports_custom_fields'] = true;
     return $info;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:30,代码来源:seedy_post.php

示例6: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_code('downloads');
     require_css('downloads');
     require_lang('downloads');
     require_code('ocfiltering');
     $number = array_key_exists('param', $map) ? intval($map['param']) : 10;
     $filter = array_key_exists('filter', $map) ? $map['filter'] : '*';
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('downloads');
     $sql_filter = ocfilter_to_sqlfragment($filter, 'p.category_id', 'download_categories', 'parent_id', 'p.category_id', 'id');
     // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'download_downloads p WHERE validated=1 AND (' . $sql_filter . ') ORDER BY add_date DESC', $number);
     $title = do_lang_tempcode('RECENT', make_string_tempcode(integer_format($number)), do_lang_tempcode('SECTION_DOWNLOADS'));
     if (array_key_exists('title', $map) && $map['title'] != '') {
         $title = protect_from_escaping(escape_html($map['title']));
     }
     $out = new ocp_tempcode();
     foreach ($rows as $i => $row) {
         if ($i != 0) {
             $out->attach(do_template('BLOCK_SEPARATOR'));
         }
         $out->attach(get_download_html($row, true, true, $zone));
     }
     if ($out->is_empty()) {
         if (has_actual_page_access(NULL, 'cms_downloads', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_downloads')) {
             $submit_url = build_url(array('page' => 'cms_downloads', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_downloads'));
         } else {
             $submit_url = new ocp_tempcode();
         }
         return do_template('BLOCK_NO_ENTRIES', array('_GUID' => '74399763a51102bdd6e6d92c2c11354f', 'HIGH' => false, 'TITLE' => $title, 'MESSAGE' => do_lang_tempcode('NO_DOWNLOADS_YET'), 'ADD_NAME' => do_lang_tempcode('ADD_DOWNLOAD'), 'SUBMIT_URL' => $submit_url));
     }
     return do_template('BLOCK_MAIN_RECENT_DOWNLOADS', array('_GUID' => '257fa1b83d1b6fe3acbceb2b618e6d7f', 'TITLE' => $title, 'CONTENT' => $out, 'NUMBER' => integer_format($number)));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:39,代码来源:main_recent_downloads.php

示例7: run

 /**
  * Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
  *
  * @param  boolean		Whether to look deep into the database (or whatever else might be time-intensive) for links
  * @return array			Array of links and where to show
  */
 function run($exhaustive = false)
 {
     if (!addon_installed('catalogues')) {
         return array();
     }
     $ret = array();
     if (has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_catalogues')) {
         $ret[] = array('cms', 'catalogues', array('cms_catalogues', array('type' => 'misc'), get_module_zone('cms_catalogues')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('CATALOGUES'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'COUNT(*)', NULL, '', true))))), 'DOC_CATALOGUES');
     }
     if ($exhaustive) {
         $catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('c_name', 'c_title', 'c_description', 'c_ecommerce'), NULL, '', 10, NULL, true);
         if (!is_null($catalogues)) {
             $ret2 = array();
             foreach ($catalogues as $row) {
                 if (substr($row['c_name'], 0, 1) == '_') {
                     continue;
                 }
                 if ($row['c_ecommerce'] == 0 || addon_installed('shopping')) {
                     if (has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues', array('catalogues_catalogue', $row['c_name']))) {
                         $ret2[] = array('cms', 'of_catalogues', array('cms_catalogues', array('type' => 'misc', 'catalogue_name' => $row['c_name']), get_module_zone('cms_catalogues')), do_lang_tempcode('ITEMS_HERE', escape_html(get_translated_text($row['c_title'])), escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('catalogue_entries', 'COUNT(*)', array('c_name' => $row['c_name']), '', true)))), get_translated_text($row['c_description']));
                     }
                 }
             }
             if (count($ret2) < 10) {
                 $ret = array_merge($ret, $ret2);
             }
         }
     }
     return $ret;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:36,代码来源:catalogues.php

示例8: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('iotds');
     require_css('iotds');
     $mode = array_key_exists('param', $map) ? $map['param'] : 'current';
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('iotds');
     if (has_actual_page_access(NULL, 'cms_iotds', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_iotds')) {
         $submit_url = build_url(array('page' => 'cms_iotds', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_iotds'));
     } else {
         $submit_url = new ocp_tempcode();
     }
     if ($mode == 'current') {
         $iotd = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('is_current' => 1), 'ORDER BY id DESC', 1);
     } elseif (is_numeric($mode)) {
         $iotd = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('id' => intval($mode)), '', 1);
         if (!array_key_exists(0, $iotd)) {
             return do_template('BLOCK_NO_ENTRIES', array('HIGH' => true, 'TITLE' => do_lang_tempcode('IOTD'), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('ADD_IOTD'), 'SUBMIT_URL' => $submit_url));
         }
     } else {
         $cnt = $GLOBALS['SITE_DB']->query_value('iotd', 'COUNT(*)', array('used' => 1));
         if ($cnt == 0) {
             return do_template('BLOCK_NO_ENTRIES', array('HIGH' => true, 'TITLE' => do_lang_tempcode('IOTD'), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('ADD_IOTD'), 'SUBMIT_URL' => $submit_url));
         }
         $at = mt_rand(0, $cnt - 1);
         $iotd = $GLOBALS['SITE_DB']->query_select('iotd', array('*'), array('used' => 1), '', 1, $at);
     }
     if (!array_key_exists(0, $iotd)) {
         return do_template('BLOCK_NO_ENTRIES', array('_GUID' => '62baa388e068d4334f7a6c6093ead56a', 'HIGH' => true, 'TITLE' => do_lang_tempcode('IOTD'), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('ADD_IOTD'), 'SUBMIT_URL' => $submit_url));
     }
     $myrow = $iotd[0];
     $image_url = $myrow['url'];
     if (url_is_local($image_url)) {
         $image_url = get_custom_base_url() . '/' . $image_url;
     }
     $view_url = build_url(array('page' => 'iotds', 'wide' => 1, 'type' => 'view', 'id' => $myrow['id']), $zone);
     require_code('images');
     $thumb_url = ensure_thumbnail($myrow['url'], $myrow['thumb_url'], 'iotds', 'iotd', $myrow['id']);
     $caption = get_translated_tempcode($myrow['i_title']);
     $image = do_image_thumb($thumb_url, do_lang('IOTD'));
     $archive_url = build_url(array('page' => 'iotds', 'type' => 'misc'), $zone);
     $tpl = do_template('IOTD', array('_GUID' => 'ca9c4b4941c12c15f7bdfe4cb57cd266', 'ID' => strval($myrow['id']), 'IMAGE_URL' => $image_url, 'SUBMITTER' => strval($myrow['submitter']), 'VIEW_URL' => $view_url, 'CAPTION' => $caption, 'IMAGE' => $image));
     $map2 = array('_GUID' => 'd710da3675a1775867168ae37db02ad4', 'CURRENT' => $mode == 'current', 'FULL_URL' => $view_url, 'ID' => strval($myrow['id']), 'CONTENT' => $tpl, 'ARCHIVE_URL' => $archive_url, 'SUBMIT_URL' => $submit_url);
     if (get_option('is_on_comments') == '1' && get_forum_type() != 'none' && $myrow['allow_comments'] >= 1) {
         $map2['COMMENT_COUNT'] = '1';
     }
     return do_template('BLOCK_MAIN_IOTD', $map2);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:53,代码来源:main_iotd.php

示例9: info

 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'catalogues';
     $info['date_field'] = 'c_add_date';
     $info['id_field'] = 'c_name';
     $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues') ? build_url(array('page' => 'cms_catalogues', 'type' => 'add_entry', 'catalogue_name' => '!'), get_module_zone('cms_catalogues')) : new ocp_tempcode();
     $info['category_field'] = 'c_name';
     $info['category_type'] = 'catalogues_catalogue';
     $info['id_is_string'] = true;
     require_lang('catalogues');
     $info['title'] = do_lang_tempcode('CATALOGUES');
     $info['category_is_string'] = true;
     $info['archive_url'] = build_url(array('page' => 'catalogues'), get_module_zone('catalogues'));
     $info['cms_page'] = 'cms_catalogues';
     return $info;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:23,代码来源:catalogue.php

示例10: info

 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'authors';
     $info['date_field'] = NULL;
     $info['id_field'] = 'author';
     $info['add_url'] = has_submit_permission('mid', get_member(), get_ip_address(), 'cms_authors') ? build_url(array('page' => 'cms_authors', 'type' => '_ad'), get_module_zone('cms_authors')) : new ocp_tempcode();
     $info['category_field'] = NULL;
     $info['submitter_field'] = 'forum_handle';
     $info['id_is_string'] = true;
     require_lang('authors');
     $info['title'] = do_lang_tempcode('AUTHORS');
     $info['category_is_string'] = true;
     $info['archive_url'] = build_url(array('page' => 'authors'), get_module_zone('authors'));
     $info['cms_page'] = 'cms_authors';
     $info['supports_custom_fields'] = true;
     return $info;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:24,代码来源:author.php

示例11: info

 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'comcode_pages';
     $info['date_field'] = 'p_add_date';
     $info['id_field'] = array('the_zone', 'the_page');
     $info['add_url'] = has_submit_permission('high', get_member(), get_ip_address(), 'cms_comcode_pages') ? build_url(array('page' => 'cms_comcode_pages', 'type' => 'ed'), get_module_zone('cms_comcode_pages')) : new ocp_tempcode();
     $info['category_field'] = array('the_zone', 'the_page');
     $info['category_type'] = '!';
     $info['submitter_field'] = 'p_submitter';
     $info['id_is_string'] = true;
     require_lang('zones');
     $info['title'] = do_lang_tempcode('COMCODE_PAGES');
     $info['validated_field'] = 'p_validated';
     $info['category_is_string'] = true;
     $info['archive_url'] = build_url(array('page' => 'sitemap'), get_page_zone('sitemap'));
     $info['cms_page'] = 'cms_comcode_pages';
     return $info;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:25,代码来源:comcode_page.php

示例12: render_tab

 /**
  * Standard modular render function for profile tab hooks.
  *
  * @param  MEMBER			The ID of the member who is being viewed
  * @param  MEMBER			The ID of the member who is doing the viewing
  * @param  boolean		Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
  * @return array			A triple: The tab title, the tab contents, the suggested tab order
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     require_lang('galleries');
     $title = do_lang_tempcode('GALLERIES');
     $order = 30;
     if ($leave_to_ajax_if_possible) {
         return array($title, NULL, $order);
     }
     $galleries = new ocp_tempcode();
     require_code('galleries');
     require_css('galleries');
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'galleries WHERE name LIKE \'' . db_encode_like('member\\_' . strval($member_id_of) . '\\_%') . '\'');
     foreach ($rows as $i => $row) {
         $galleries->attach(do_template('GALLERY_SUBGALLERY_WRAP', array('CONTENT' => show_gallery_box($row, 'root', false, get_module_zone('galleries')))));
         $this->attach_gallery_subgalleries($row['name'], $galleries);
     }
     $add_gallery_url = new ocp_tempcode();
     $add_image_url = new ocp_tempcode();
     $add_video_url = new ocp_tempcode();
     if ($member_id_of == $member_id_viewing) {
         if (count($rows) == 0) {
             $test = $GLOBALS['SITE_DB']->query_select('galleries', array('accept_images', 'accept_videos', 'name'), array('is_member_synched' => 1));
             if (array_key_exists(0, $test)) {
                 if ($test[0]['accept_images'] == 1) {
                     $add_image_url = build_url(array('page' => 'cms_galleries', 'type' => 'ad', 'cat' => 'member_' . strval($member_id_of) . '_' . $test[0]['name']), get_module_zone('cms_galleries'));
                 }
                 if ($test[0]['accept_videos'] == 1) {
                     $add_video_url = build_url(array('page' => 'cms_galleries', 'type' => 'av', 'cat' => 'member_' . strval($member_id_of) . '_' . $test[0]['name']), get_module_zone('cms_galleries'));
                 }
             }
         } else {
             if (has_actual_page_access(NULL, 'cms_galleries', NULL, NULL) && has_submit_permission('cat_mid', get_member(), get_ip_address(), 'cms_galleries')) {
                 $add_gallery_url = build_url(array('page' => 'cms_galleries', 'type' => 'ac', 'cat' => $rows[0]['name']), get_module_zone('cms_galleries'));
             }
         }
     }
     $content = do_template('OCF_MEMBER_PROFILE_GALLERIES', array('MEMBER_ID' => strval($member_id_of), 'GALLERIES' => $galleries, 'ADD_GALLERY_URL' => $add_gallery_url, 'ADD_IMAGE_URL' => $add_image_url, 'ADD_VIDEO_URL' => $add_video_url));
     return array($title, $content, $order);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:47,代码来源:galleries.php

示例13: info

 /**
  * Standard modular info function for award hooks. Provides information to allow task reporting, randomisation, and add-screen linking, to function.
  *
  * @return ?array	Map of award content-type info (NULL: disabled).
  */
 function info()
 {
     $info = array();
     $info['connection'] = $GLOBALS['SITE_DB'];
     $info['table'] = 'quizzes';
     $info['date_field'] = 'q_add_date';
     $info['id_field'] = 'id';
     $info['add_url'] = has_submit_permission('high', get_member(), get_ip_address(), 'cms_quiz') ? build_url(array('page' => 'cms_quiz', 'type' => 'ad'), get_module_zone('cms_quiz')) : new ocp_tempcode();
     $info['category_field'] = 'q_type';
     $info['parent_spec__table_name'] = NULL;
     $info['parent_spec__parent_name'] = NULL;
     $info['parent_spec__field_name'] = NULL;
     $info['parent_field_name'] = NULL;
     $info['submitter_field'] = 'q_submitter';
     $info['id_is_string'] = false;
     require_lang('quiz');
     $info['title'] = do_lang_tempcode('QUIZZES');
     $info['validated_field'] = 'q_validated';
     $info['category_is_string'] = true;
     $info['archive_url'] = build_url(array('page' => 'quiz'), get_module_zone('quiz'));
     $info['cms_page'] = 'cms_quiz';
     $info['supports_custom_fields'] = true;
     return $info;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:29,代码来源:quiz.php

示例14: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     if (!array_key_exists('param', $map)) {
         $map['param'] = '';
     }
     require_code('banners');
     require_lang('banners');
     $b_type = $map['param'];
     $myquery = 'SELECT * FROM ' . get_table_prefix() . 'banners WHERE validated=1 AND ' . db_string_equal_to('b_type', $b_type) . ' AND (expiry_date IS NULL OR expiry_date>' . strval(time()) . ') ORDER BY hits_from+hits_to DESC';
     $_banners = $GLOBALS['SITE_DB']->query($myquery, 200);
     $assemble = new ocp_tempcode();
     $banners = array();
     foreach ($_banners as $banner) {
         $description = get_translated_tempcode($banner['caption']);
         $bd = show_banner($banner['name'], $banner['b_title_text'], $description, $banner['img_url'], '', $banner['site_url'], $banner['b_type']);
         $banners[] = array('BANNER' => $bd, 'NAME' => $banner['name'], 'URL' => $banner['site_url'], 'DESCRIPTION' => $description, 'HITSFROM' => strval($banner['hits_from']), 'HITSTO' => strval($banner['hits_to']), 'VIEWSFROM' => strval($banner['views_from']), 'VIEWSTO' => strval($banner['views_to']), 'ADDDATE' => strval($banner['add_date']), 'SUBMITTER' => strval($banner['submitter']));
     }
     if (has_actual_page_access(NULL, 'cms_banners', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_banners')) {
         $submit_url = build_url(array('page' => 'cms_banners', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_banners'));
     } else {
         $submit_url = new ocp_tempcode();
     }
     return do_template('BLOCK_MAIN_TOPSITES', array('TYPE' => $map['param'], 'BANNERS' => $banners, 'SUBMIT_URL' => $submit_url));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:30,代码来源:main_topsites.php

示例15: banners_script


//.........这里部分代码省略.........
        // Input parameters (clicks-in from source site)
        if (is_null($source)) {
            $source = get_param('source', '');
        }
        // To allow overriding to specify a specific banner
        if ($dest != '') {
            $myquery = 'SELECT * FROM ' . get_table_prefix() . 'banners WHERE ' . db_string_equal_to('name', $dest);
        } else {
            $myquery = 'SELECT * FROM ' . get_table_prefix() . 'banners WHERE ((the_type<>' . strval(BANNER_CAMPAIGN) . ') OR (campaign_remaining>0)) AND ((expiry_date IS NULL) OR (expiry_date>' . strval(time()) . ')) AND ' . db_string_not_equal_to('name', $source) . ' AND validated=1 AND ' . db_string_equal_to('b_type', $b_type);
        }
        // Run Query
        $rows = $GLOBALS['SITE_DB']->query($myquery, 500, NULL, true);
        if (is_null($rows)) {
            $rows = array();
        }
        // Error, but tolerate it as it could be on each page load
        // Filter out what we don't have permission for
        if (get_option('use_banner_permissions', true) === '1') {
            load_user_stuff();
            require_code('permissions');
            $groups = _get_where_clause_groups(get_member());
            if (!is_null($groups)) {
                $perhaps = collapse_1d_complexity('category_name', $GLOBALS['SITE_DB']->query('SELECT category_name FROM ' . get_table_prefix() . 'group_category_access WHERE ' . db_string_equal_to('module_the_name', 'banners') . ' AND (' . $groups . ')'));
                $new_rows = array();
                foreach ($rows as $row) {
                    if (in_array($row['name'], $perhaps)) {
                        $new_rows[] = $row;
                    }
                }
                $rows = $new_rows;
            }
        }
        // Are we allowed to show default banners?
        $counter = 0;
        $show_defaults = true;
        while (array_key_exists($counter, $rows)) {
            $myrow = $rows[$counter];
            if ($myrow['the_type'] == BANNER_CAMPAIGN) {
                $show_defaults = false;
            }
            $counter++;
        }
        // Count the total of all importance_modulus entries
        $tally = 0;
        $counter = 0;
        $bound = array();
        while (array_key_exists($counter, $rows)) {
            $myrow = $rows[$counter];
            if ($myrow['the_type'] == 2 && !$show_defaults) {
                $myrow['importance_modulus'] = 0;
            }
            $tally += $myrow['importance_modulus'];
            $bound[$counter] = $tally;
            $counter++;
        }
        if ($tally == 0) {
            load_user_stuff();
            require_code('permissions');
            if (has_actual_page_access(NULL, 'cms_banners') && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_banners')) {
                $add_banner_url = build_url(array('page' => 'cms_banners', 'type' => 'ad'), get_module_zone('cms_banners'));
            } else {
                $add_banner_url = new ocp_tempcode();
            }
            $content = do_template('BANNERS_NONE', array('_GUID' => 'b786ec327365d1ef38134ce401db9dd2', 'ADD_BANNER_URL' => $add_banner_url));
            if ($ret) {
                return $content;
            }
            $echo = do_template('BASIC_HTML_WRAP', array('_GUID' => '00c8549b88dac8a1291450eb5b681d80', 'TARGET' => '_top', 'TITLE' => do_lang_tempcode('BANNER'), 'CONTENT' => $content));
            $echo->evaluate_echo();
            return NULL;
        }
        // Choose which banner to show from the results
        $rand = mt_rand(0, $tally);
        for ($i = 0; $i < $counter; $i++) {
            if ($rand <= $bound[$i]) {
                break;
            }
        }
        $name = $rows[$i]['name'];
        // Update the counts (ones done per-view)
        if (get_db_type() != 'xml') {
            $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'banners SET views_to=(views_to+1) WHERE ' . db_string_equal_to('name', $name), 1, NULL, false, true);
        }
        if ($source != '') {
            if (get_db_type() != 'xml') {
                $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'banners SET views_from=(views_from+1) WHERE ' . db_string_equal_to('name', $name), 1, NULL, false, true);
            }
        }
        // Display!
        $img = $rows[$i]['img_url'];
        $caption = get_translated_tempcode($rows[$i]['caption']);
        $content = show_banner($name, $rows[$i]['b_title_text'], $caption, $img, $source, $rows[$i]['site_url'], $rows[$i]['b_type']);
        if ($ret) {
            return $content;
        }
        $echo = do_template('BASIC_HTML_WRAP', array('_GUID' => 'd23424ded86c850f4ae0006241407ff9', 'TITLE' => do_lang_tempcode('BANNER'), 'CONTENT' => $content));
        $echo->evaluate_echo();
    }
    return NULL;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:banners.php


注:本文中的has_submit_permission函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。