Example #1
0
/**
 * Get a splurghified version of the specified item.
 *
 * @param  string			The name of what the key we want to reference is in our array of maps (e.g. 'id')
 * @param  array			A row of maps for data we are splurghing; this is probably just the result of $GLOBALS['SITE_DB']->query_select
 * @param  URLPATH		The stub that links will be passed through
 * @param  ID_TEXT		The page name we will be saving customised HTML under
 * @param  TIME			The time we did our last change to the data being splurghed (so it can see if we can simply decache instead of deriving)
 * @param  ?AUTO_LINK	The ID that is at the root of our tree (NULL: db_get_first_id)
 * @return string			A string of HTML that represents our splurghing (will desplurgh in the users browser)
 */
function splurgh_master_build($key_name, $map, $url_stub, $_cache_file, $last_change_time, $first_id = NULL)
{
    if (is_null($first_id)) {
        $first_id = db_get_first_id();
    }
    if (!array_key_exists($first_id, $map)) {
        return '';
    }
    if (!has_js()) {
        warn_exit(do_lang_tempcode('MSG_JS_NEEDED'));
    }
    require_javascript('javascript_splurgh');
    if (is_browser_decacheing()) {
        $last_change_time = time();
    }
    $cache_file = zone_black_magic_filterer(get_custom_file_base() . '/' . get_zone_name() . '/pages/html_custom/' . filter_naughty(user_lang()) . '/' . filter_naughty($_cache_file) . '.htm');
    if (!file_exists($cache_file) || is_browser_decacheing() || filesize($cache_file) == 0 || $last_change_time > filemtime($cache_file)) {
        $myfile = @fopen($cache_file, 'wt');
        if ($myfile === false) {
            intelligent_write_error($cache_file);
        }
        $fulltable = array();
        $splurgh = _splurgh_do_node($map, $first_id, '', $fulltable, 0);
        $page = do_template('SPLURGH', array('_GUID' => '8775edfc5a386fdf2cec69b0fc889952', 'KEY_NAME' => $key_name, 'URL_STUB' => $url_stub, 'SPLURGH' => str_replace('"', '\'', $splurgh)));
        $ev = $page->evaluate();
        if (fwrite($myfile, $ev) < strlen($ev)) {
            warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
        }
        fclose($myfile);
        fix_permissions($cache_file);
        sync_file($cache_file);
        return $ev;
    }
    return file_get_contents($cache_file, FILE_TEXT);
}
Example #2
0
 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     require_javascript('javascript_translate');
     require_code('lang2');
     require_code('lang_compile');
     require_lang('lang');
     $type = get_param('type', 'misc');
     if ($type == 'content') {
         return $this->interface_content();
     }
     if ($type == '_content') {
         return $this->set_lang_content();
     }
     if ($type == 'criticise') {
         return $this->criticise();
     }
     if ($type == 'misc') {
         return $this->interface_code();
     }
     if ($type == '_code') {
         return $this->set_lang_code();
     }
     if ($type == '_code2') {
         return $this->set_lang_code_2();
     }
     // This is a lang string setter called from an external source. Strings may be from many different files
     if ($type == 'export_po') {
         return $this->export_po();
     }
     return new ocp_tempcode();
 }
 function init()
 {
     //		require_javascript("og/HtmlPanel.js");
     require_javascript("og/MessageManager.js");
     ajx_current("panel", "messages", null, null, true);
     ajx_replace(true);
 }
 function init()
 {
     require_javascript('og/EmailAccountMenu.js');
     require_javascript("og/MailManager.js");
     ajx_current("panel", "mails-containerpanel", null, null, true);
     ajx_replace(true);
 }
 function init()
 {
     require_javascript('MailAccountMenu.js', $this->plugin_name);
     require_javascript("MailManager.js", $this->plugin_name);
     ajx_current("panel", "mails-containerpanel", null, null, true);
     ajx_replace(true);
 }
 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     require_javascript('javascript_realtime_rain');
     require_javascript('javascript_ajax');
     require_javascript('javascript_more');
     require_lang('realtime_rain');
     require_css('realtime_rain');
     $title = get_page_title('REALTIME_RAIN');
     if (!has_js()) {
         // Send them to the page permissions screen
         $url = build_url(array('page' => 'admin_stats', 'type' => 'misc'), '_SELF');
         require_code('site2');
         assign_refresh($url, 5.0);
         return do_template('REDIRECT_SCREEN', array('URL' => $url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('NO_JS_REALTIME')));
     }
     $GLOBALS['TEMPCODE_SETGET']['chrome_frame'] = make_string_tempcode('1');
     if (browser_matches('ie6')) {
         attach_message(do_lang_tempcode('IE_OLD_PLEASE_UPGRADE'), 'warn');
     }
     if (!has_js()) {
         // Send them to the stats screen
         $url = build_url(array('page' => 'admin_stats', 'type' => 'misc'), '_SELF');
         require_code('site2');
         assign_refresh($url, 5.0);
         return do_template('REDIRECT_SCREEN', array('URL' => $url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('NO_JS_ADVANCED_SCREEN_REALTIME_RAIN')));
     }
     $min_time = $GLOBALS['SITE_DB']->query_value('stats', 'MIN(date_and_time)');
     if (is_null($min_time)) {
         $min_time = time();
     }
     return do_template('REALTIME_RAIN_OVERLAY', array('MIN_TIME' => strval($min_time)));
 }
 /**
  * Standard aed_module run_start.
  *
  * @param  ID_TEXT		The type of module execution
  * @return tempcode		The output of the run
  */
 function run_start($type)
 {
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/emoticons';
     $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_emoticons';
     $this->add_one_label = do_lang_tempcode('ADD_EMOTICON');
     $this->edit_this_label = do_lang_tempcode('EDIT_THIS_EMOTICON');
     $this->edit_one_label = do_lang_tempcode('EDIT_EMOTICON');
     require_lang('dearchive');
     require_code('images');
     if (get_forum_type() != 'ocf') {
         warn_exit(do_lang_tempcode('NO_OCF'));
     } else {
         ocf_require_all_forum_stuff();
     }
     require_code('ocf_general_action');
     require_code('ocf_general_action2');
     if ($type == 'ad') {
         require_javascript('javascript_ajax');
         $script = find_script('snippet');
         $this->javascript = "\n\t\t\t\tvar form=document.getElementById('main_form');\n\t\t\t\tform.old_submit=form.onsubmit;\n\t\t\t\tform.onsubmit=function()\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=true;\n\t\t\t\t\t\tvar url='" . addslashes($script) . "?snippet=exists_emoticon&name='+window.encodeURIComponent(form.elements['code'].value);\n\t\t\t\t\t\tif (!do_ajax_field_test(url))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\tif (typeof form.old_submit!='undefined' && form.old_submit) return form.old_submit();\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t};\n\t\t\t";
     }
     if ($type == 'misc') {
         return $this->misc();
     }
     if ($type == 'import') {
         return $this->import();
     }
     if ($type == '_import') {
         return $this->_import();
     }
     return new ocp_tempcode();
 }
	function init() {
		$js_manager_info = array('js_file' => "og/FileManager.js");
		Hook::fire('change_js_manager', $this, $js_manager_info);
		require_javascript(array_var($js_manager_info, 'js_file'), array_var($js_manager_info, 'plugin'));
		
		ajx_current("panel", "files", null, null, true);
		ajx_replace(true);
	}
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('activities');
     require_css('activities');
     require_javascript('javascript_activities_state');
     require_javascript('javascript_jquery');
     $title = array_key_exists('param', $map) ? $map['param'] : do_lang('STATUS_UPDATE');
     return do_template('BLOCK_MAIN_ACTIVITIES_STATE', array('TITLE' => $title));
 }
 function init()
 {
     $ot = ObjectTypes::findById(array_var($_REQUEST, 'type_id'));
     $dim = Dimensions::findById(array_var($_REQUEST, 'dim_id'));
     evt_add("refresh member list parameters", array('object_type_id' => array_var($_REQUEST, 'type_id'), 'dimension_id' => array_var($_REQUEST, 'dim_id'), 'dimension_code' => $dim instanceof Dimension ? $dim->getCode() : '', 'object_type_name' => $ot instanceof ObjectType ? $ot->getName() : ''));
     require_javascript("og/MemberManager.js");
     ajx_current("panel", "members", null, null, true);
     ajx_replace(true);
 }
Example #11
0
 /**
  * Get a preview(s) of a (group of) template(s), as a full standalone piece of HTML in Tempcode format.
  * Uses sources/lorem.php functions to place appropriate stock-text. Should not hard-code things, as the code is intended to be declaritive.
  * Assumptions: You can assume all Lang/CSS/Javascript files in this addon have been pre-required.
  *
  * @return array			Array of previews, each is Tempcode. Normally we have just one preview, but occasionally it is good to test templates are flexible (e.g. if they use IF_EMPTY, we can test with and without blank data).
  */
 function tpl_preview__administrative__site_tree_editor_screen()
 {
     require_javascript('javascript_ajax');
     require_javascript('javascript_more');
     require_javascript('javascript_tree_list');
     require_javascript('javascript_dragdrop');
     require_javascript('javascript_site_tree_editor');
     require_lang('zones');
     return array(lorem_globalise(do_lorem_template('SITE_TREE_EDITOR_SCREEN', array('TITLE' => lorem_title())), NULL, '', true));
 }
Example #12
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('activities');
     require_css('activities');
     require_javascript('javascript_activities');
     require_javascript('javascript_jquery');
     require_javascript('javascript_base64');
     if (!array_key_exists('max', $map)) {
         $map['max'] = '10';
     }
     if (array_key_exists('param', $map)) {
         $title = $map['param'];
     } else {
         $title = do_lang_tempcode('ACTIVITIES_TITLE');
     }
     // See if we're displaying for a specific member
     if (array_key_exists('member', $map)) {
         $member_ids = array_map('intval', explode(',', $map['member']));
     } else {
         // No specific user. Use ourselves.
         $member_ids = array(get_member());
     }
     require_css('side_blocks');
     require_lang('activities');
     require_code('activities');
     require_code('addons_overview');
     $mode = array_key_exists('mode', $map) ? $map['mode'] : 'all';
     $viewer_id = get_member();
     //We'll need this later anyway.
     $guest_id = $GLOBALS['FORUM_DRIVER']->get_guest_id();
     list($proceed_selection, $whereville) = find_activities($viewer_id, $mode, $member_ids);
     $can_remove_others = has_zone_access($viewer_id, 'adminzone') ? true : false;
     $content = array();
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'act_start';
     $start = get_param_integer('act_start', 0);
     $max = get_param_integer('act_max', intval($map['max']));
     if ($proceed_selection === true) {
         $max_rows = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'activities WHERE ' . $whereville);
         require_code('templates_results_browser');
         $results_browser = results_browser(do_lang('ACTIVITIES_TITLE'), NULL, $start, 'act_start', $max, 'act_max', $max_rows, NULL, NULL, true, false, 7, NULL, 'tab__activities');
         $activities = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'activities WHERE ' . $whereville . ' ORDER BY a_time DESC', $max, $start);
         if (!is_null($activities) && count($activities) > 0) {
             foreach ($activities as $row) {
                 list($message, $memberpic, $datetime, $member_url, $lang_string) = render_activity($row);
                 $content[] = array('LANG_STRING' => $lang_string, 'ADDON_ICON' => find_addon_icon($row['a_addon']), 'BITS' => $message, 'MEMPIC' => $memberpic, 'USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($row['a_member_id']), 'DATETIME' => strval($datetime), 'MEMBER_URL' => $member_url, 'LIID' => strval($row['id']), 'ALLOW_REMOVE' => $row['a_member_id'] == $viewer_id || $can_remove_others ? '1' : '0');
             }
         }
     } else {
         $results_browser = new ocp_tempcode();
     }
     // No entries
     return do_template('BLOCK_MAIN_ACTIVITIES', array('TITLE' => $title, 'MODE' => $mode, 'MEMBER_IDS' => implode(',', $member_ids), 'CONTENT' => $content, 'GROW' => array_key_exists('grow', $map) ? $map['grow'] == '1' : true, 'RESULTS_BROWSER' => $results_browser, 'MAX' => $start == 0 ? strval($max) : NULL));
 }
Example #13
0
 /**
  * Get a preview(s) of a (group of) template(s), as a full standalone piece of HTML in Tempcode format.
  * Uses sources/lorem.php functions to place appropriate stock-text. Should not hard-code things, as the code is intended to be declaritive.
  * Assumptions: You can assume all Lang/CSS/Javascript files in this addon have been pre-required.
  *
  * @return array			Array of previews, each is Tempcode. Normally we have just one preview, but occasionally it is good to test templates are flexible (e.g. if they use IF_EMPTY, we can test with and without blank data).
  */
 function tpl_preview__administrative__redirecte_table_screen()
 {
     require_javascript('javascript_ajax');
     $fields = new ocp_tempcode();
     foreach (placeholder_array() as $i => $row) {
         $fields->attach(do_lorem_template('REDIRECTE_TABLE_REDIRECT', array('I' => strval($i), 'TO_ZONES' => placeholder_options(), 'FROM_ZONES' => placeholder_options(), 'FROM_PAGE' => lorem_word(), 'TO_PAGE' => lorem_word_2(), 'TICKED' => true, 'NAME' => "is_transparent_{$i}")));
     }
     $new = do_lorem_template('REDIRECTE_TABLE_REDIRECT', array('I' => 'new', 'TO_ZONES' => placeholder_options(), 'FROM_ZONES' => placeholder_options(), 'FROM_PAGE' => '', 'TO_PAGE' => '', 'TICKED' => false, 'NAME' => 'is_transparent_new'));
     $out = do_lorem_template('REDIRECTE_TABLE_SCREEN', array('NOTES' => '', 'PING_URL' => placeholder_url(), 'WARNING_DETAILS' => '', 'TITLE' => lorem_title(), 'FIELDS' => $fields, 'NEW' => $new, 'URL' => placeholder_url()));
     return array(lorem_globalise($out, NULL, '', true));
 }
 /**
  * Get a preview(s) of a (group of) template(s), as a full standalone piece of HTML in Tempcode format.
  * Uses sources/lorem.php functions to place appropriate stock-text. Should not hard-code things, as the code is intended to be declaritive.
  * Assumptions: You can assume all Lang/CSS/Javascript files in this addon have been pre-required.
  *
  * @return array			Array of previews, each is Tempcode. Normally we have just one preview, but occasionally it is good to test templates are flexible (e.g. if they use IF_EMPTY, we can test with and without blank data).
  */
 function tpl_preview__administrative__permissions_tree_editor_screen()
 {
     require_javascript('javascript_ajax');
     require_javascript('javascript_tree_list');
     require_javascript('javascript_more');
     require_lang('permissions');
     $groups = new ocp_tempcode();
     foreach (placeholder_array() as $id => $group_name) {
         $groups->attach(form_input_list_entry("{$id}", false, $group_name));
     }
     return array(lorem_globalise(do_lorem_template('PERMISSIONS_TREE_EDITOR_SCREEN', array('USERGROUPS' => placeholder_array(), 'TITLE' => lorem_title(), 'INITIAL_GROUP' => lorem_phrase(), 'COLOR' => lorem_phrase(), 'GROUPS' => $groups, 'EDITOR' => lorem_phrase())), NULL, '', true));
 }
/**
 * Put the contents of a page inside an iframe. This is typically used when a page is being used to traverse a result-set that spans multiple screens.
 *
 * @param  tempcode		The title
 * @param  ?integer		The time between refreshes (NULL: do not refresh)
 * @param  ?mixed			Data. A refresh will only happen if an AJAX-check indicates this data has changed (NULL: no check)
 * @return ?tempcode		The page output to finish off our current page stream such that it will spawn the iframe (NULL: not internalised)
 */
function internalise_own_screen($title, $refresh_time = NULL, $refresh_if_changed = NULL)
{
    if (get_value('no_frames') === '1' || get_param_integer('no_frames', 0) == 1 || get_param_integer('keep_no_frames', 0) == 1) {
        return NULL;
    }
    if (!has_js()) {
        return NULL;
    }
    // We need JS to make this a seamless process
    if (strpos(ocp_srv('REQUEST_URI'), '/iframe.php') !== false) {
        return NULL;
    }
    // This is already in the iframe
    require_javascript('javascript_ajax');
    require_javascript('javascript_iframe_screen');
    $url = find_script('iframe') . '?zone=' . rawurlencode(get_zone_name()) . '&wide_high=1&utheme=' . rawurlencode($GLOBALS['FORUM_DRIVER']->get_theme());
    foreach (array_merge($_GET, $_POST) as $key => $param) {
        if (!is_string($param)) {
            continue;
        }
        if (substr($key, 0, 5) == 'keep_' && skippable_keep($key, $param)) {
            continue;
        }
        if (get_magic_quotes_gpc()) {
            $param = stripslashes($param);
        }
        $url .= '&' . $key . '=' . urlencode($param);
    }
    if (!is_null($refresh_if_changed)) {
        require_javascript('javascript_sound');
        $change_detection_url = find_script('change_detection') . '?whatever=1';
        foreach ($_GET as $key => $param) {
            if (!is_string($param)) {
                continue;
            }
            if (substr($key, 0, 5) == 'keep_' && skippable_keep($key, $param)) {
                continue;
            }
            if (get_magic_quotes_gpc()) {
                $param = stripslashes($param);
            }
            $change_detection_url .= '&' . $key . '=' . urlencode($param);
        }
    } else {
        $refresh_if_changed = '';
        $change_detection_url = '';
    }
    return do_template('IFRAME_SCREEN', array('_GUID' => '06554eb227428fd5c648dee3c5b38185', 'TITLE' => $title, 'REFRESH_IF_CHANGED' => md5(serialize($refresh_if_changed)), 'CHANGE_DETECTION_URL' => $change_detection_url, 'REFRESH_TIME' => is_null($refresh_time) ? '' : strval($refresh_time), 'IFRAME_URL' => $url));
}
Example #16
0
 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     require_lang('ecommerce');
     require_code('ecommerce');
     require_lang('shopping');
     require_javascript('javascript_shopping');
     require_css('shopping');
     require_code('users_active_actions');
     $type = get_param('type', 'misc');
     if ($type == 'misc') {
         return $this->misc();
     }
     if ($type == 'show_orders') {
         return $this->show_orders();
     }
     if ($type == 'order_det') {
         return $this->order_details();
     }
     if ($type == 'order_act') {
         $action = either_param('action');
         if ($action == 'add_note') {
             return $this->add_note();
         }
         if ($action == 'dispatch') {
             return $this->dispatch();
         }
         if ($action == 'del_order') {
             return $this->delete_order();
         }
         if ($action == 'return') {
             return $this->return_order();
         }
         if ($action == 'hold') {
             return $this->hold_order();
         }
     }
     if ($type == '_add_note') {
         return $this->_add_note();
     }
     if ($type == 'order_export') {
         return $this->order_export();
     }
     if ($type == '_order_export') {
         return $this->_order_export();
     }
     return new ocp_tempcode();
 }
Example #17
0
 /**
  * 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)
 {
     $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=activities&filter=' . strval($member_id_of);
     require_lang('activities');
     $title = do_lang_tempcode('ACTIVITIES_TITLE');
     $order = 70;
     // Need to declare these here as the Tempcode engine can't look as deep, into a loop (I think), as it would need to, to find the block declaring the dependency
     require_css('activities');
     require_javascript('javascript_activities_state');
     require_javascript('javascript_activities');
     require_javascript('javascript_jquery');
     require_javascript('javascript_base64');
     // Allow user to link up things for syndication
     $syndications = array();
     if ($member_id_of == $member_id_viewing) {
         $dests = find_all_hooks('systems', 'syndication');
         foreach (array_keys($dests) as $hook) {
             require_code('hooks/systems/syndication/' . $hook);
             $ob = object_factory('Hook_Syndication_' . $hook);
             if ($ob->is_available()) {
                 if (either_param('syndicate_stop__' . $hook, NULL) !== NULL) {
                     $ob->auth_unset($member_id_of);
                 } elseif (either_param('syndicate_start__' . $hook, NULL) !== NULL) {
                     $url_map = array('page' => '_SELF', 'type' => 'view', 'id' => $member_id_of, 'oauth_in_progress' => 1);
                     $url_map['syndicate_start__' . $hook] = 1;
                     $oauth_url = build_url($url_map, '_SELF', NULL, false, false, false, 'tab__activities');
                     $ob->auth_set($member_id_of, $oauth_url);
                 } elseif (running_script('index') && !$leave_to_ajax_if_possible && $ob->auth_is_set($member_id_of) && either_param('oauth_in_progress', NULL) === NULL && !$GLOBALS['IS_ACTUALLY_ADMIN']) {
                     /*	running_script('index') won't work currently due to execution contexts, and it is never non-AJAX, and it's probably not needed anyway
                     			// Do a refresh to make sure the token is updated
                     			$url_map=array('page'=>'_SELF','type'=>'view','id'=>$member_id_of,'oauth_in_progress'=>1);
                     			$url_map['syndicate_start__'.$hook]=1;
                     			$oauth_url=build_url($url_map,'_SELF',NULL,false,false,false,'tab__activities');
                     			$ob->auth_set($member_id_of,$oauth_url);
                     			*/
                 }
                 $syndications[$hook] = array('SYNDICATION_IS_SET' => $ob->auth_is_set($member_id_of), 'SYNDICATION_SERVICE_NAME' => $ob->get_service_name());
             }
         }
     }
     if ($leave_to_ajax_if_possible) {
         return array($title, NULL, $order);
     }
     $content = do_template('OCF_MEMBER_PROFILE_ACTIVITIES', array('MEMBER_ID' => strval($member_id_of), 'SYNDICATIONS' => $syndications));
     return array($title, $content, $order);
 }
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('messaging');
     require_code('feedback');
     $to = array_key_exists('param', $map) ? $map['param'] : get_option('staff_address');
     $post = post_param('post', '');
     if (post_param_integer('_comment_form_post', 0) == 1 && $post != '') {
         if (addon_installed('captcha')) {
             if (get_option('captcha_on_feedback') == '1') {
                 require_code('captcha');
                 enforce_captcha();
             }
         }
         $message = new ocp_tempcode();
         /*Used to be written out here*/
         attach_message(do_lang_tempcode('MESSAGE_SENT'), 'inform');
         require_code('mail');
         $email_from = trim(post_param('email', $GLOBALS['FORUM_DRIVER']->get_member_email_address(get_member())));
         mail_wrap(post_param('title'), $post, array($to), NULL, $email_from, $GLOBALS['FORUM_DRIVER']->get_username(get_member()), 3, NULL, false, get_member());
         if ($email_from != '') {
             mail_wrap(do_lang('YOUR_MESSAGE_WAS_SENT_SUBJECT', post_param('title')), do_lang('YOUR_MESSAGE_WAS_SENT_BODY', $post), array($email_from), NULL, '', '', 3, NULL, false, get_member());
         }
     } else {
         $message = new ocp_tempcode();
     }
     $box_title = array_key_exists('title', $map) ? $map['title'] : do_lang('CONTACT_US');
     $private = array_key_exists('private', $map) && $map['private'] == '1';
     $em = $GLOBALS['FORUM_DRIVER']->get_emoticon_chooser();
     require_javascript('javascript_editing');
     $comcode_help = build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false));
     require_javascript('javascript_validation');
     $comment_url = get_self_url();
     $email_optional = array_key_exists('email_optional', $map) ? intval($map['email_optional']) == 1 : true;
     if (addon_installed('captcha')) {
         require_code('captcha');
         $use_captcha = get_option('captcha_on_feedback') == '1' && use_captcha();
         if ($use_captcha) {
             generate_captcha();
         }
     } else {
         $use_captcha = false;
     }
     $comment_details = do_template('COMMENTS_POSTING_FORM', array('JOIN_BITS' => '', 'FIRST_POST_URL' => '', 'FIRST_POST' => '', 'USE_CAPTCHA' => $use_captcha, 'EMAIL_OPTIONAL' => $email_optional, 'POST_WARNING' => '', 'COMMENT_TEXT' => '', 'GET_EMAIL' => !$private, 'GET_TITLE' => !$private, 'EM' => $em, 'DISPLAY' => 'block', 'TITLE' => $box_title, 'COMMENT_URL' => $comment_url));
     $out = do_template('BLOCK_MAIN_CONTACT_SIMPLE', array('_GUID' => '298a357f442f440c6b42e58d6717e57c', 'EMAIL_OPTIONAL' => true, 'COMMENT_DETAILS' => $comment_details, 'MESSAGE' => $message));
     return $out;
 }
Example #19
0
/**
 * Render a member profile.
 *
 * @param  MEMBER			The ID of the member who is being viewed
 * @param  ?MEMBER		The ID of the member who is doing the viewing (NULL: current member)
 * @param  ?ID_TEXT		The username of the member who is being viewed (NULL: work out from member_id_of)
 * @return tempcode		The rendered profile
 */
function render_profile_tabset($member_id_of, $member_id_viewing = NULL, $username = NULL)
{
    if (is_null($member_id_viewing)) {
        $member_id_viewing = get_member();
    }
    $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
    if (is_null($username) || is_guest($member_id_of)) {
        warn_exit(do_lang_tempcode('USER_NO_EXIST'));
    }
    $tabs = array();
    $hooks = find_all_hooks('systems', 'profiles_tabs');
    if (isset($hooks['edit'])) {
        $hooks = array('edit' => $hooks['edit']) + $hooks;
    }
    foreach (array_keys($hooks) as $hook) {
        require_code('hooks/systems/profiles_tabs/' . $hook);
        $ob = object_factory('Hook_Profiles_Tabs_' . $hook);
        if ($ob->is_active($member_id_of, $member_id_viewing)) {
            $tabs[$hook] = $ob->render_tab($member_id_of, $member_id_viewing, !browser_matches('ie6') && !browser_matches('ie7') && has_js());
        }
    }
    global $M_SORT_KEY;
    $M_SORT_KEY = 2;
    uasort($tabs, 'multi_sort');
    require_javascript('javascript_profile');
    require_javascript('javascript_ajax');
    load_up_all_self_page_permissions($member_id_viewing);
    if (addon_installed('awards')) {
        require_code('awards');
        $awards = find_awards_for('member', strval($member_id_of));
    } else {
        $awards = array();
    }
    $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
    // Get it again, in case it changed
    $title = get_page_title('MEMBER_PROFILE', true, array(escape_html($username)), NULL, $awards);
    $_tabs = array();
    $i = 0;
    foreach ($tabs as $hook => $tab) {
        $_tabs[] = array('TAB_TITLE' => $tab[0], 'TAB_CODE' => $hook, 'TAB_CONTENT' => $tab[1], 'TAB_FIRST' => $i == 0, 'TAB_LAST' => !array_key_exists($i + 1, $tabs));
        $i++;
    }
    return do_template('OCF_MEMBER_PROFILE_SCREEN', array('TITLE' => $title, 'TABS' => $_tabs, 'MEMBER_ID' => strval($member_id_of)));
}
Example #20
0
 /**
  * Get a preview(s) of a (group of) template(s), as a full standalone piece of HTML in Tempcode format.
  * Uses sources/lorem.php functions to place appropriate stock-text. Should not hard-code things, as the code is intended to be declaritive.
  * Assumptions: You can assume all Lang/CSS/Javascript files in this addon have been pre-required.
  *
  * @return array			Array of previews, each is Tempcode. Normally we have just one preview, but occasionally it is good to test templates are flexible (e.g. if they use IF_EMPTY, we can test with and without blank data).
  */
 function tpl_preview__ocf_edit_signature_tab()
 {
     require_javascript('javascript_swfupload');
     require_javascript('javascript_validation');
     require_javascript('javascript_posting');
     require_lang('comcode');
     require_lang('ocf');
     require_css('ocf');
     $buttons = new ocp_tempcode();
     $_buttons = array('img', 'thumb', 'url', 'page', 'code', 'quote', 'hide', 'box', 'block', 'list', 'html');
     foreach ($_buttons as $button) {
         $buttons->attach(do_lorem_template('COMCODE_EDITOR_BUTTON', array('DIVIDER' => true, 'FIELD_NAME' => lorem_word(), 'TITLE' => lorem_phrase(), 'B' => $button)));
     }
     $micro_buttons = new ocp_tempcode();
     $_micro_buttons = array(array('t' => 'b'), array('t' => 'i'));
     foreach ($_micro_buttons as $button) {
         $micro_buttons->attach(do_lorem_template('COMCODE_EDITOR_MICRO_BUTTON', array('FIELD_NAME' => lorem_word(), 'TITLE' => lorem_phrase(), 'B' => $button['t'])));
     }
     $comcode_editor = do_lorem_template('COMCODE_EDITOR', array('POSTING_FIELD' => lorem_word(), 'BUTTONS' => $buttons, 'MICRO_BUTTONS' => $micro_buttons));
     $posting_form = do_lorem_template('POSTING_FORM', array('TABINDEX_PF' => placeholder_number(), 'JAVASCRIPT' => '', 'PREVIEW' => true, 'COMCODE_EDITOR' => $comcode_editor, 'COMCODE_EDITOR_SMALL' => $comcode_editor, 'CLASS' => lorem_word(), 'COMCODE_URL' => placeholder_url(), 'EXTRA' => '', 'POST_COMMENT' => lorem_phrase(), 'EMOTICON_CHOOSER' => '', 'SUBMIT_NAME' => lorem_word(), 'HIDDEN_FIELDS' => new ocp_tempcode(), 'COMCODE_HELP' => placeholder_url(), 'URL' => placeholder_url(), 'POST' => lorem_sentence(), 'DEFAULT_PARSED' => lorem_sentence(), 'CONTINUE_URL' => placeholder_url(), 'ATTACHMENTS' => lorem_phrase(), 'SPECIALISATION' => new ocp_tempcode(), 'SPECIALISATION2' => new ocp_tempcode()));
     return array(lorem_globalise(do_lorem_template('OCF_EDIT_SIGNATURE_TAB', array('SIZE' => placeholder_filesize(), 'SIGNATURE' => lorem_phrase())), NULL, '', true));
 }
Example #21
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('chat');
     require_css('side_blocks');
     require_css('chat');
     require_javascript('javascript_text_ghosts');
     require_javascript('javascript_shake');
     require_javascript('javascript_shoutbox');
     require_javascript('javascript_ajax');
     $room_id = array_key_exists('param', $map) ? intval($map['param']) : NULL;
     $num_messages = array_key_exists('max', $map) ? intval($map['max']) : 5;
     if (is_null($room_id)) {
         $room_id = $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'MIN(id)', array('is_im' => 0));
         if (is_null($room_id)) {
             return new ocp_tempcode();
         }
     }
     $room_check = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('id' => $room_id), '', 1);
     if (!array_key_exists(0, $room_check)) {
         return new ocp_tempcode();
     }
     require_code('chat');
     if (!check_chatroom_access($room_check[0], true)) {
         global $DO_NOT_CACHE_THIS;
         // We don't cache against access, so we have a problem and can't cache
         $DO_NOT_CACHE_THIS = true;
         return new ocp_tempcode();
     }
     $content = NULL;
     if (get_value('no_frames') === '1') {
         $content = shoutbox_script(true, $room_id);
     }
     $last_message_id = $GLOBALS['SITE_DB']->query_value('chat_messages', 'MAX(id)', array('room_id' => $room_id));
     if (is_null($last_message_id)) {
         $last_message_id = -1;
     }
     return do_template('BLOCK_SIDE_SHOUTBOX_IFRAME', array('LAST_MESSAGE_ID' => strval($last_message_id), 'CONTENT' => $content, 'ROOM_ID' => strval($room_id), 'NUM_MESSAGES' => strval($num_messages)));
 }
/**
 * Get the tempcode for a results launcher.
 *
 * @param  tempcode		The title/name of the resource we are browsing through
 * @param  ID_TEXT		The page name we are launching into
 * @param  AUTO_LINK		The category ID we are browsing in
 * @param  integer		The maximum number of rows to show per browser page
 * @param  integer		The maximum number of rows in the entire dataset
 * @param  ID_TEXT		The page type this browser is browsing through (e.g. 'category')
 * @param  integer		The maximum number of quick-jump page links to show
 * @return tempcode		The results launcher
 */
function results_launcher($title, $page, $category_id, $max, $max_rows, $type, $max_page_links = 5)
{
    if ($max < 1) {
        $max = 1;
    }
    require_javascript('javascript_results_browser');
    $out = new ocp_tempcode();
    if ($max < $max_rows) {
        $part = new ocp_tempcode();
        $num_pages = $max == 0 ? 0 : min(intval(ceil($max_rows / $max)), $max_page_links);
        for ($x = 0; $x < $num_pages; $x++) {
            $cat_url = build_url(array('page' => $page, 'type' => $type, 'start' => $x == 0 ? NULL : $x * $max, 'id' => $category_id), get_module_zone($page));
            $part->attach(do_template('RESULTS_LAUNCHER_PAGE_NUMBER_LINK', array('_GUID' => 'd19c001f3ecff62105f803d541f7d945', 'TITLE' => $title, 'URL' => $cat_url, 'P' => strval($x + 1))));
        }
        $num_pages = intval(ceil($max_rows / $max));
        if ($num_pages > $max_page_links) {
            $url_stub = build_url(array('page' => $page, 'type' => $type, 'id' => $category_id), '_SELF');
            $part->attach(do_template('RESULTS_LAUNCHER_CONTINUE', array('_GUID' => '0a55d3c1274618c16bd6d8d2cf36676c', 'TITLE' => $title, 'MAX' => strval($max), 'NUM_PAGES' => integer_format($num_pages), 'URL_STUB' => $url_stub)));
        }
        $out->attach(do_template('RESULTS_LAUNCHER_WRAP', array('_GUID' => 'c1c01ee07c456832e7e66a03f26c2288', 'PART' => $part)));
    }
    return $out;
}
Example #23
0
 /**
  * Standard aed_module run_start.
  *
  * @param  ID_TEXT		The type of module execution
  * @return tempcode		The output of the run
  */
 function run_start($type)
 {
     $this->cat_aed_module = new Module_cms_catalogues_cat();
     $this->alt_aed_module = new Module_cms_catalogues_alt();
     $GLOBALS['MODULE_CMS_CATALOGUES'] = $this;
     if (get_value('disable_cat_cat_perms') === '1') {
         $this->permissions_cat_require_b = NULL;
         $this->permissions_cat_name_b = NULL;
         $this->cat_aed_module->permissions_cat_require = NULL;
         $this->cat_aed_module->permissions_cat_name = NULL;
     }
     $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_catalogues';
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/catalogues';
     require_lang('catalogues');
     require_lang('fields');
     require_code('catalogues');
     if ($type == 'add_catalogue') {
         require_javascript('javascript_ajax');
         $script = find_script('snippet');
         $this->alt_aed_module->javascript .= "\n\t\t\t\tvar form=document.getElementById('new_field_0_name').form;\n\t\t\t\tform.old_submit=form.onsubmit;\n\t\t\t\tform.onsubmit=function()\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=true;\n\t\t\t\t\t\tvar url='" . addslashes($script) . "?snippet=exists_catalogue&name='+window.encodeURIComponent(form.elements['name'].value);\n\t\t\t\t\t\tif (!do_ajax_field_test(url))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdocument.getElementById('submit_button').disabled=false;\n\t\t\t\t\t\tif (typeof form.old_submit!='undefined' && form.old_submit) return form.old_submit();\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t};\n\t\t\t";
     }
     // Decide what to do
     if ($type == 'misc') {
         return $this->misc();
     }
     if ($type == 'import') {
         return $this->import_catalogue();
     }
     if ($type == '_import') {
         return $this->_import_catalogue();
     }
     if ($type == 'export') {
         return $this->export_catalogue();
     }
     return new ocp_tempcode();
 }
Example #24
0
<?php

require_javascript('og/modules/doubleListSelCtrl.js');
if (!isset($for_task)) {
    $for_task = false;
}
// build columm list
$list = array();
if (is_array($columns)) {
    foreach ($columns as $colid) {
        if ($colid != '') {
            $list[] = array('id' => $colid, 'text' => '', 'selected' => true);
        }
    }
}
$options = array();
foreach ($allowed_columns as $acol) {
    $add = true;
    foreach ($list as $k => $item) {
        if ($acol['id'] == $item['id']) {
            $list[$k]['text'] = $acol['name'];
            $add = false;
            break;
        }
    }
    if ($add) {
        $list[] = array('id' => $acol['id'], 'text' => $acol['name'], 'selected' => false);
    }
    if (!isset($order_by) || $order_by == '') {
        $order_by = 'updated_on';
    }
<?php

require_javascript('og/modules/memberListView.js');
if (!isset($genid)) {
    $genid = gen_id();
}
if (!isset($actual_associations)) {
    $actual_associations = array();
}
function order_members($members)
{
    $tmp_array = array();
    foreach ($members as $mem) {
        if (!isset($tmp_array[$mem->getDepth()])) {
            $tmp_array[$mem->getDepth()] = array();
        }
        $tmp_array[$mem->getDepth()][$mem->getId()] = array('m' => $mem, 'sub' => array());
    }
    $level = max(array_keys($tmp_array));
    while ($level > 1) {
        foreach ($tmp_array[$level] as $mid => &$minfo) {
            $tmp_array[$level - 1][$minfo['m']->getParentMemberId()]['sub'][$mid] = $minfo;
        }
        $level--;
    }
    $ordered_members = array();
    foreach (array_shift($tmp_array) as $id => $info) {
        $ordered_members[] = $info['m'];
        flatten_members_array($info['sub'], $ordered_members);
    }
    return $ordered_members;
 /**
  * Get a preview(s) of a (group of) template(s), as a full standalone piece of HTML in Tempcode format.
  * Uses sources/lorem.php functions to place appropriate stock-text. Should not hard-code things, as the code is intended to be declaritive.
  * Assumptions: You can assume all Lang/CSS/Javascript files in this addon have been pre-required.
  *
  * @return array			Array of previews, each is Tempcode. Normally we have just one preview, but occasionally it is good to test templates are flexible (e.g. if they use IF_EMPTY, we can test with and without blank data).
  */
 function tpl_preview__form_screen_1()
 {
     require_lang('comcode');
     require_lang('dates');
     require_javascript('javascript_colour_picker');
     require_javascript('javascript_theme_colours');
     $fields = new ocp_tempcode();
     $list = new ocp_tempcode();
     $name = placeholder_random_id();
     $input = do_lorem_template('FORM_SCREEN_INPUT_LINE', array('MAXLENGTH' => placeholder_number(), 'TABINDEX' => placeholder_number(), 'REQUIRED' => '', 'NAME' => $name, 'DEFAULT' => ''));
     $fields->attach(do_lorem_template('FORM_SCREEN_FIELD', array('REQUIRED' => true, 'SKIP_LABEL' => false, 'BORING_NAME' => $name, 'NAME' => lorem_word(), 'DESCRIPTION' => lorem_sentence_html(), 'DESCRIPTION_SIDE' => '', 'INPUT' => $input, 'COMCODE' => '')));
     $name = placeholder_random_id();
     $input = do_lorem_template('FORM_SCREEN_INPUT_TEXT', array('RAW' => true, 'SCROLLS' => '', 'TABINDEX' => placeholder_number(), 'REQUIRED' => '', 'NAME' => $name, 'DEFAULT' => ''));
     $fields->attach(do_lorem_template('FORM_SCREEN_FIELD', array('REQUIRED' => true, 'SKIP_LABEL' => false, 'BORING_NAME' => $name, 'NAME' => lorem_word(), 'DESCRIPTION' => lorem_sentence_html(), 'DESCRIPTION_SIDE' => '', 'INPUT' => $input, 'COMCODE' => '')));
     $name = placeholder_random_id();
     $input = do_lorem_template('FORM_SCREEN_INPUT_CODENAME', array('MAXLENGTH' => placeholder_number(), 'TABINDEX' => placeholder_number(), 'REQUIRED' => '', 'NAME' => $name, 'DEFAULT' => ''));
     $fields->attach(do_lorem_template('FORM_SCREEN_FIELD', array('REQUIRED' => true, 'SKIP_LABEL' => false, 'BORING_NAME' => $name, 'NAME' => lorem_word(), 'DESCRIPTION' => lorem_sentence_html(), 'DESCRIPTION_SIDE' => '', 'INPUT' => $input, 'COMCODE' => '')));
     $name = placeholder_random_id();
     $input = do_lorem_template('FORM_SCREEN_INPUT_TICK', array('CHECKED' => 'true', 'TABINDEX' => placeholder_number(), 'NAME' => $name));
     $fields->attach(do_lorem_template('FORM_SCREEN_FIELD', array('REQUIRED' => true, 'SKIP_LABEL' => false, 'BORING_NAME' => $name, 'NAME' => lorem_word(), 'DESCRIPTION' => lorem_sentence_html(), 'DESCRIPTION_SIDE' => '', 'INPUT' => $input, 'COMCODE' => '')));
     $fields->attach(do_lorem_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => false, 'TITLE' => lorem_phrase(), 'THEME_ALSO_INCLUDE_PAGES' => false)));
     foreach (placeholder_array() as $key => $value) {
         $list->attach(do_lorem_template('FORM_SCREEN_INPUT_LIST_ENTRY', array('SELECTED' => false, 'DISABLED' => false, 'CLASS' => '', 'NAME' => placeholder_random_id(), 'TEXT' => lorem_phrase())));
     }
     $radios = new ocp_tempcode();
     $name = placeholder_random_id();
     $radios->attach(do_lorem_template('FORM_SCREEN_INPUT_RADIO_LIST_ENTRY', array('DESCRIPTION' => lorem_sentence(), 'CHECKED' => 'true', 'TABINDEX' => placeholder_number(), 'NAME' => $name, 'VALUE' => placeholder_random(), 'TEXT' => lorem_phrase())));
     $radios->attach(do_lorem_template('FORM_SCREEN_INPUT_RADIO_LIST_ENTRY', array('DESCRIPTION' => lorem_sentence(), 'CHECKED' => 'false', 'TABINDEX' => placeholder_number(), 'NAME' => $name, 'VALUE' => placeholder_random(), 'TEXT' => lorem_phrase())));
     $radios->attach(do_lorem_template('FORM_SCREEN_INPUT_RADIO_LIST_ENTRY', array('DESCRIPTION' => lorem_sentence(), 'CHECKED' => 'false', 'TABINDEX' => placeholder_number(), 'NAME' => $name, 'VALUE' => placeholder_random(), 'TEXT' => lorem_phrase())));
     $name = placeholder_random_id();
     $input = do_lorem_template('FORM_SCREEN_INPUT_ALL_AND_NOT', array('TABINDEX' => placeholder_number(), 'BASE' => $name, 'RADIOS' => $radios, 'LIST' => $list));
     $fields->attach(do_lorem_template('FORM_SCREEN_FIELD', array('REQUIRED' => true, 'SKIP_LABEL' => false, 'BORING_NAME' => $name . '_list', 'NAME' => lorem_word(), 'DESCRIPTION' => lorem_sentence_html(), 'DESCRIPTION_SIDE' => '', 'INPUT' => $input, 'COMCODE' => '')));
     $name = placeholder_random_id();
     $input = do_lorem_template('FORM_SCREEN_INPUT_AUTHOR', array('TABINDEX' => placeholder_number(), 'REQUIRED' => '', 'NAME' => $name, 'DEFAULT' => ''));
     $_description = new ocp_tempcode();
     $_description->attach(lorem_phrase());
     $_description->attach(do_lorem_template('FORM_DESCRIP_SEP'));
     $extra = do_lorem_template('HYPERLINK_POPUP_WINDOW', array('URL' => placeholder_url(), 'TITLE' => lorem_phrase(), 'CAPTION' => lorem_phrase()));
     $_description->attach($extra);
     $fields->attach(do_lorem_template('FORM_SCREEN_FIELD', array('REQUIRED' => true, 'SKIP_LABEL' => false, 'BORING_NAME' => $name, 'NAME' => lorem_word(), 'DESCRIPTION' => $_description, 'DESCRIPTION_SIDE' => '', 'INPUT' => $input, 'COMCODE' => '')));
     $fields->attach(do_lorem_template('FORM_SCREEN_INPUT_COLOUR', array('TRUE_FIELD' => false, 'REQUIRED' => '', 'PRETTY_NAME' => lorem_word(), 'DESCRIPTION' => lorem_sentence(), 'TABINDEX' => placeholder_number(), '_REQUIRED' => '', 'NAME' => lorem_word(), 'DEFAULT' => '')));
     // Dates
     $start_year = intval(date('Y')) - 1;
     $start_month = intval(date('m'));
     $start_day = intval(date('d'));
     $start_hour = intval(date('H'));
     $start_minute = intval(date('i'));
     $name = placeholder_random_id();
     $time = do_lorem_template('FORM_SCREEN_INPUT_TIME', array('NULL_OK' => '', 'DISABLED' => '', 'TABINDEX' => placeholder_number(), 'MINUTES' => placeholder_options(), 'HOURS' => placeholder_options(), 'STUB' => placeholder_random_id()));
     $input = do_lorem_template('FORM_SCREEN_INPUT_DATE', array('UNLIMITED' => false, 'NULL_OK' => '', 'DISABLED' => '', 'TABINDEX' => placeholder_number(), 'YEARS' => placeholder_options(), 'MONTHS' => placeholder_options(), 'DAYS' => placeholder_options(), 'STUB' => $name, 'NULL' => '', 'TIME' => $time));
     $fields->attach(do_lorem_template('FORM_SCREEN_FIELD', array('REQUIRED' => true, 'SKIP_LABEL' => true, 'BORING_NAME' => '', 'NAME' => lorem_word(), 'DESCRIPTION' => lorem_sentence_html(), 'DESCRIPTION_SIDE' => '', 'INPUT' => $input, 'COMCODE' => '')));
     $name = placeholder_random_id();
     $input = do_lorem_template('FORM_SCREEN_INPUT_EMAIL', array('TABINDEX' => placeholder_number(), 'REQUIRED' => '', 'NAME' => $name, 'DEFAULT' => ''));
     $fields->attach(do_lorem_template('FORM_SCREEN_FIELD', array('REQUIRED' => true, 'SKIP_LABEL' => false, 'BORING_NAME' => $name, 'NAME' => lorem_word(), 'DESCRIPTION' => lorem_sentence_html(), 'DESCRIPTION_SIDE' => '', 'INPUT' => $input, 'COMCODE' => '')));
     $name = placeholder_random_id();
     $input = do_lorem_template('FORM_SCREEN_INPUT_FLOAT', array('TABINDEX' => placeholder_number(), 'REQUIRED' => '', 'NAME' => $name, 'DEFAULT' => ''));
     $fields->attach(do_lorem_template('FORM_SCREEN_FIELD', array('REQUIRED' => true, 'SKIP_LABEL' => false, 'BORING_NAME' => $name, 'NAME' => lorem_word(), 'DESCRIPTION' => lorem_sentence_html(), 'DESCRIPTION_SIDE' => '', 'INPUT' => $input, 'COMCODE' => '')));
     $fields->attach(do_lorem_template('FORM_SCREEN_INPUT_HUGE', array('RAW' => true, 'SCROLLS' => '', 'DESCRIPTION_SIDE' => lorem_sentence(), 'REQUIRED' => '', '_REQUIRED' => '', 'TABINDEX' => placeholder_number(), 'PRETTY_NAME' => lorem_word(), 'DESCRIPTION' => lorem_sentence(), 'NAME' => placeholder_random_id(), 'DEFAULT' => '', 'ROWS' => "20")));
     $_comcode = do_lorem_template('COMCODE_MESSAGE', array('NAME' => lorem_word(), 'W' => '', 'URL' => placeholder_url()));
     $fields->attach(do_lorem_template('FORM_SCREEN_INPUT_HUGE_COMCODE', array('SCROLLS' => '', 'DESCRIPTION_SIDE' => lorem_sentence(), 'REQUIRED' => 'wysiwyg', '_REQUIRED' => 'wysiwyg', 'TABINDEX' => placeholder_number(), 'COMCODE' => $_comcode, 'PRETTY_NAME' => lorem_word(), 'DESCRIPTION' => lorem_phrase(), 'NAME' => placeholder_random_id(), 'DEFAULT' => lorem_word(), 'DEFAULT_PARSED' => lorem_word(), 'ROWS' => "20")));
     $hidden = do_lorem_template('FORM_SCREEN_INPUT_DATE_NULL', array('STUB' => placeholder_random_id()));
     return array(lorem_globalise(do_lorem_template('FORM', array('GET' => NULL, 'SKIP_VALIDATION' => true, 'HIDDEN' => $hidden, 'TITLE' => lorem_title(), 'URL' => placeholder_url(), 'FIELDS' => $fields, 'SUBMIT_NAME' => lorem_word(), 'TEXT' => lorem_sentence_html())), NULL, '', true));
 }
Example #27
0
	require_javascript("og/CSVCombo.js");
	require_javascript("og/DateField.js");
	require_javascript('og/tasks/main.js');
	require_javascript('og/tasks/addTask.js');
	require_javascript('og/tasks/drawing.js');
	require_javascript('og/tasks/TasksTopToolbar.js');
	require_javascript('og/tasks/TasksBottomToolbar.js');
	require_javascript('og/tasks/print.js');
	require_javascript('og/tasks/TaskPopUp.js');

	if (config_option('use tasks dependencies')) {
		require_javascript('og/tasks/task_dependencies.js');
	}

	if(config_option('multi_assignment') && Plugins::instance()->isActivePlugin('crpm')){
		require_javascript('multi_assignment.js', 'crpm');
	}

	$loc = user_config_option('localization');
	if (strlen($loc) > 2) $loc = substr($loc, 0, 2);

	$genid = gen_id();
	
	$all_templates_array = array();
	$project_templates_array = array();
	$templates_array = array();
	$project_templates_array = array();
	$tasks_array = array();
	$internal_milestones_array = array();
	$external_milestones_array = array();
	$users_array = array();
Example #28
0
 /**
  * Standard modular render function for profile tabs edit 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 tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set)
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     $title = do_lang_tempcode('AVATAR');
     $order = 20;
     // Actualiser
     if (post_param_integer('submitting_avatar_tab', 0) == 1) {
         require_code('uploads');
         if (has_specific_permission($member_id_viewing, 'own_avatars')) {
             if (!(is_swf_upload(true) && array_key_exists('avatar_file', $_FILES) || array_key_exists('avatar_file', $_FILES) && is_uploaded_file($_FILES['avatar_file']['tmp_name']))) {
                 $urls = array();
                 $stock = post_param('avatar_alt_url', '');
                 if ($stock == '') {
                     $stock = post_param('avatar_stock', NULL);
                     if (!is_null($stock)) {
                         $urls[0] = $stock == '' ? '' : find_theme_image($stock, false, true);
                     } else {
                         $urls[0] = '';
                     }
                     // None
                 } else {
                     if (url_is_local($stock) && !$GLOBALS['FORUM_DRIVER']->is_super_admin($member_id_viewing)) {
                         $old = $GLOBALS['FORUM_DB']->query_value('f_members', 'm_avatar_url', array('id' => $member_id_of));
                         if ($old != $stock) {
                             access_denied('ASSOCIATE_EXISTING_FILE');
                         }
                     }
                     $urls[0] = $stock;
                     // URL
                 }
             } else {
                 // We have chosen an upload. Note that we will not be looking at alt_url at this point, even though it is specified below for canonical reasons
                 $urls = get_url('avatar_alt_url', 'avatar_file', file_exists(get_custom_file_base() . '/uploads/avatars') ? 'uploads/avatars' : 'uploads/ocf_avatars', 0, OCP_UPLOAD_IMAGE, false, '', '', false, true);
                 if ((get_base_url() != get_forum_base_url() || array_key_exists('on_msn', $GLOBALS['SITE_INFO']) && $GLOBALS['SITE_INFO']['on_msn'] == '1') && $urls[0] != '' && url_is_local($urls[0])) {
                     $urls[0] = get_custom_base_url() . '/' . $urls[0];
                 }
             }
             $avatar_url = $urls[0];
         } else {
             $stock = post_param('avatar_stock');
             $avatar_url = $stock == '' ? '' : find_theme_image($stock, false, true);
         }
         require_code('ocf_members_action');
         require_code('ocf_members_action2');
         ocf_member_choose_avatar($avatar_url, $member_id_of);
         attach_message(do_lang_tempcode('SUCCESS_SAVE'), 'inform');
     }
     if ($leave_to_ajax_if_possible) {
         return NULL;
     }
     // UI fields
     $avatar_url = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_avatar_url');
     require_javascript('javascript_multi');
     $fields = new ocp_tempcode();
     require_code('form_templates');
     require_code('themes2');
     $ids = get_all_image_ids_type('ocf_default_avatars', true);
     $found_it = false;
     foreach ($ids as $id) {
         $pos = strpos($avatar_url, '/' . $id);
         $selected = $pos !== false;
         if ($selected) {
             $found_it = true;
         }
     }
     $hidden = new ocp_tempcode();
     if (has_specific_permission($member_id_viewing, 'own_avatars')) {
         $javascript = 'standardAlternateFields(\'avatar_file\',\'avatar_alt_url\',\'avatar_stock*\',true);';
         $fields->attach(form_input_upload(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_UPLOAD'), 'avatar_file', false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images'))));
         handle_max_file_size($hidden, 'image');
         $fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('URL')), do_lang_tempcode('DESCRIPTION_ALTERNATE_URL'), 'avatar_alt_url', $found_it ? '' : $avatar_url, false));
         $fields->attach(form_input_picture_choose_specific(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('STOCK')), do_lang_tempcode('DESCRIPTION_ALTERNATE_STOCK'), 'avatar_stock', $ids, $avatar_url, NULL, NULL, true));
     } else {
         $javascript = '';
         $fields->attach(form_input_picture_choose_specific(do_lang_tempcode('STOCK'), '', 'avatar_stock', $ids, $avatar_url, NULL, NULL, true));
     }
     if ($avatar_url != '') {
         if (url_is_local($avatar_url)) {
             $avatar_url = get_complex_base_url($avatar_url) . '/' . $avatar_url;
         }
         $avatar = do_template('OCF_TOPIC_POST_AVATAR', array('_GUID' => '50a5902f3ab7e384d9cf99577b222cc8', 'AVATAR' => $avatar_url));
     } else {
         $avatar = do_lang_tempcode('NONE_EM');
     }
     $width = ocf_get_member_best_group_property($member_id_of, 'max_avatar_width');
     $height = ocf_get_member_best_group_property($member_id_of, 'max_avatar_height');
     $text = do_template('OCF_EDIT_AVATAR_TAB', array('_GUID' => 'dbdac6ca3bc752b54d2a24a4c6e69c7c', 'MEMBER_ID' => strval($member_id_of), 'USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($member_id_of), 'AVATAR' => $avatar, 'WIDTH' => integer_format($width), 'HEIGHT' => integer_format($height)));
     $hidden = new ocp_tempcode();
     $hidden->attach(form_input_hidden('submitting_avatar_tab', '1'));
     return array($title, $fields, $text, $javascript, $order, $hidden);
 }
Example #29
0
 /**
  * The UI to show a usergroup.
  *
  * @return tempcode		The UI
  */
 function usergroup()
 {
     $id = get_param_integer('id');
     if ($id == db_get_first_id()) {
         warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
     }
     $map = has_specific_permission(get_member(), 'see_hidden_groups') ? array('id' => $id) : array('id' => $id, 'g_hidden' => 0);
     $groups = $GLOBALS['FORUM_DB']->query_select('f_groups', array('*'), $map, '', 1);
     if (!array_key_exists(0, $groups)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $group = $groups[0];
     $club = $group['g_is_private_club'] == 1;
     $name = get_translated_text($group['g_name'], $GLOBALS['FORUM_DB']);
     $title = get_page_title($club ? 'CLUB' : 'USERGROUP', true, array(escape_html($name)));
     // Leadership
     if (!is_null($group['g_group_leader']) && !is_null($GLOBALS['FORUM_DRIVER']->get_username($group['g_group_leader']))) {
         $leader_name = $GLOBALS['FORUM_DRIVER']->get_username($group['g_group_leader']);
         if (is_null($leader_name)) {
             $leader_name = do_lang('UNKNOWN');
         }
         $leader_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $group['g_group_leader']), get_module_zone('members'));
         $leader_link = hyperlink($leader_url, $leader_name, false, true);
         $leader = paragraph(do_lang_tempcode('GROUP_LED_BY', $leader_link), 'gfgdfggdf');
     } else {
         $leader = new ocp_tempcode();
     }
     // Promotion
     if (addon_installed('points') && !is_null($group['g_promotion_threshold']) && !is_null($group['g_promotion_target'])) {
         $promote_link = ocf_get_group_link($group['g_promotion_target']);
         $promotion_info = do_lang_tempcode('OCF_PROMOTION_INFO', integer_format($group['g_promotion_threshold']), $promote_link->evaluate());
     } else {
         $promotion_info = new ocp_tempcode();
     }
     // To add
     if (ocf_may_control_group($id, get_member())) {
         $add_url = build_url(array('page' => '_SELF', 'type' => 'add_to', 'id' => $id), '_SELF');
     } else {
         $add_url = new ocp_tempcode();
     }
     // To apply
     $my_groups = $GLOBALS['FORUM_DRIVER']->get_members_groups(get_member(), false, false);
     if (is_guest()) {
         $apply_url = new ocp_tempcode();
         $apply_text = new ocp_tempcode();
     } else {
         if (!in_array($id, $my_groups)) {
             $apply_url = build_url(array('page' => '_SELF', 'type' => 'apply', 'id' => $id), '_SELF');
             $apply_text = do_lang_tempcode('APPLY_TO_GROUP');
         } elseif (ocf_get_member_primary_group(get_member()) != $id) {
             $apply_url = build_url(array('page' => '_SELF', 'type' => 'resign', 'id' => $id), '_SELF');
             $apply_text = do_lang_tempcode('RESIGN_FROM_GROUP');
         } else {
             $apply_url = new ocp_tempcode();
             $apply_text = new ocp_tempcode();
         }
     }
     require_code('templates_results_table');
     $sortables = array();
     list($sortable, $sort_order) = explode(' ', get_param('p_sort', 'date_and_time DESC'));
     // Primary members
     $start = get_param_integer('p_start', 0);
     $max = get_param_integer('p_max', 50);
     $_primary_members = ocf_get_group_members_raw($id, true, true, false, false, $max, $start);
     if (count($_primary_members) > 0) {
         $max_rows = ocf_get_group_members_raw_count($id, true, true, false, false);
         $primary_members = new ocp_tempcode();
         foreach ($_primary_members as $i => $primary_member) {
             $url = $GLOBALS['FORUM_DRIVER']->member_profile_url($primary_member['gm_member_id'], false, true);
             $temp = do_template('OCF_VIEW_GROUP_MEMBER', array('_GUID' => 'b96b674ac713e9790ecb78c15af1baab', 'NAME' => $primary_member['m_username'], 'URL' => $url));
             $primary_members->attach(results_entry(array($temp)));
         }
         $fields_title = results_field_title(array(do_lang_tempcode('PRIMARY_MEMBERS')), $sortables, 'p_sort', $sortable . ' ' . $sort_order);
         $primary_members = results_table(do_lang_tempcode('PRIMARY_MEMBERS'), $start, 'p_start', $max, 'p_max', $max_rows, $fields_title, $primary_members, $sortables, $sortable, $sort_order, 'p_sort', NULL, NULL, NULL, 6);
     } else {
         $primary_members = new ocp_tempcode();
     }
     $edit_url = new ocp_tempcode();
     $s_start = get_param_integer('s_start', 0);
     $s_max = get_param_integer('s_max', 50);
     $_secondary_members = ocf_get_group_members_raw($id, false, true, true, ocf_may_control_group($id, get_member()), $s_max, $s_start);
     $secondary_members = new ocp_tempcode();
     $prospective_members = new ocp_tempcode();
     $s_max_rows = ocf_get_group_members_raw_count($id, false, false, true, ocf_may_control_group($id, get_member()));
     $d_max_rows = ocf_get_group_members_raw_count($id, false, true, true, ocf_may_control_group($id, get_member()));
     foreach ($_secondary_members as $secondary_member) {
         $m_username = $GLOBALS['FORUM_DRIVER']->get_member_row_field($secondary_member['gm_member_id'], 'm_username');
         if (is_null($m_username)) {
             continue;
         }
         if ($secondary_member['gm_validated'] == 1) {
             $url = $GLOBALS['FORUM_DRIVER']->member_profile_url($secondary_member['gm_member_id'], false, true);
             $remove_url = build_url(array('page' => '_SELF', 'type' => 'remove_from', 'id' => $id, 'member_id' => $secondary_member['gm_member_id']), '_SELF');
             $temp = do_template('OCF_VIEW_GROUP_MEMBER' . (ocf_may_control_group($id, get_member()) ? '_SECONDARY' : ''), array('REMOVE_URL' => $remove_url, 'NAME' => $m_username, 'URL' => $url));
             $secondary_members->attach(results_entry(array($temp)));
         } elseif (!$add_url->is_empty()) {
             $url = $GLOBALS['FORUM_DRIVER']->member_profile_url($secondary_member['gm_member_id'], false, true);
             $accept_url = build_url(array('page' => '_SELF', 'type' => 'accept', 'id' => $id, 'member_id' => $secondary_member['gm_member_id']), '_SELF');
             $decline_url = build_url(array('page' => '_SELF', 'type' => 'decline', 'id' => $id, 'member_id' => $secondary_member['gm_member_id']), '_SELF');
             $temp = do_template('OCF_VIEW_GROUP_MEMBER_PROSPECTIVE', array('_GUID' => '16e93cf50a14e3b6a3bdf31525fd5e7f', 'ACCEPT_URL' => $accept_url, 'DECLINE_URL' => $decline_url, 'NAME' => $m_username, 'URL' => $url));
             $prospective_members->attach(results_entry(array($temp)));
         }
     }
     if (!$secondary_members->is_empty()) {
         $fields_title = results_field_title(array(do_lang_tempcode('SECONDARY_MEMBERS')), $sortables, 'p_sort', $sortable . ' ' . $sort_order);
         $secondary_members = results_table(do_lang_tempcode('SECONDARY_MEMBERS'), $s_start, 's_start', $s_max, 's_max', $s_max_rows, $fields_title, $secondary_members, $sortables, $sortable, $sort_order, 's_sort', NULL, NULL, NULL, 6);
     }
     if (!$prospective_members->is_empty()) {
         $fields_title = results_field_title(array(do_lang_tempcode('PROSPECTIVE_MEMBERS')), $sortables, 'p_sort', $sortable . ' ' . $sort_order);
         $prospective_members = results_table(do_lang_tempcode('PROSPECTIVE_MEMBERS'), $s_start, 's_start', $s_max, 's_max', $d_max_rows, $fields_title, $prospective_members, $sortables, $sortable, $sort_order, 'd_sort', NULL, NULL, NULL, 6);
     } elseif (has_actual_page_access(get_member(), 'cms_ocf_groups', get_module_zone('cms_ocf_groups'))) {
         $is_super_admin = $group['g_is_super_admin'];
         if (!has_specific_permission(get_member(), 'control_usergroups') || $is_super_admin == 1) {
             $leader_tmp = $group['g_group_leader'];
             if ($leader_tmp == get_member()) {
                 $edit_url = build_url(array('page' => 'cms_ocf_groups', 'type' => '_ed', 'id' => $id), get_module_zone('cms_ocf_groups'));
             }
         } else {
             $edit_url = build_url(array('page' => 'cms_ocf_groups', 'type' => '_ed', 'id' => $id), get_module_zone('cms_ocf_groups'));
         }
     }
     breadcrumb_set_self(make_string_tempcode(escape_html($name)));
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('USERGROUPS'))));
     if (has_actual_page_access(get_member(), 'admin_ocf_groups', get_module_zone('admin_ocf_groups'))) {
         $edit_url = build_url(array('page' => 'admin_ocf_groups', 'type' => '_ed', 'id' => $id), get_module_zone('admin_ocf_groups'));
     }
     $club_forum = NULL;
     if ($group['g_is_private_club'] == 1) {
         $club_forum = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums f LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON t.id=f.f_description', 'f.id', array('text_original' => do_lang('FORUM_FOR_CLUB', $name)));
     }
     $group_name = get_translated_text($group['g_name'], $GLOBALS['FORUM_DB']);
     $GLOBALS['META_DATA'] += array('created' => '', 'creator' => is_null($group['g_group_leader']) ? '' : $GLOBALS['FORUM_DRIVER']->get_username($group['g_group_leader']), 'publisher' => '', 'modified' => '', 'type' => 'Usergroup', 'title' => $group_name, 'identifier' => '_SEARCH:groups:view:' . strval($id), 'description' => '', 'image' => find_theme_image('bigicons/usergroups'));
     require_javascript('javascript_ajax');
     require_javascript('javascript_ajax_people_lists');
     $forum_id = NULL;
     if ($club) {
         $forum_id = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'id', array('f_name' => $group_name, 'f_category_id' => intval(get_option('club_forum_parent_category')), 'f_parent_forum' => intval(get_option('club_forum_parent_forum'))));
     }
     return do_template('OCF_VIEW_GROUP_SCREEN', array('_GUID' => 'fc6cac5c73f92ab4410b492d58976dbe', 'GROUP_NAME' => $group_name, 'ID' => strval($id), 'FORUM' => is_null($forum_id) ? '' : strval($forum_id), 'CLUB' => $club, 'EDIT_URL' => $edit_url, 'TITLE' => $title, 'LEADER' => $leader, 'PROMOTION_INFO' => $promotion_info, 'ADD_URL' => $add_url, 'APPLY_URL' => $apply_url, 'APPLY_TEXT' => $apply_text, 'PRIMARY_MEMBERS' => $primary_members, 'SECONDARY_MEMBERS' => $secondary_members, 'PROSPECTIVE_MEMBERS' => $prospective_members));
 }
Example #30
0
<?php

require_javascript('og/CalendarToolbar.js');
require_javascript('og/CalendarFunctions.js');
require_javascript('og/EventPopUp.js');
require_javascript('og/CalendarPrint.js');
require_javascript('og/EventRelatedPopUp.js');
$genid = gen_id();
?>

<script>
	scroll_to = -1;
	og.ev_cell_dates = [];
	og.events_selected = 0;
	og.eventSelected(0);
        og.config.genid = '<?php 
echo $genid;
?>
';
</script>

<?php 
define('PX_HEIGHT', 42);
$year = isset($_GET['year']) ? $_GET['year'] : (isset($_SESSION['year']) ? $_SESSION['year'] : date('Y'));
$month = isset($_GET['month']) ? $_GET['month'] : (isset($_SESSION['month']) ? $_SESSION['month'] : date('n'));
$day = isset($_GET['day']) ? $_GET['day'] : (isset($_SESSION['day']) ? $_SESSION['day'] : date('j'));
$_SESSION['year'] = $year;
$_SESSION['month'] = $month;
$_SESSION['day'] = $day;
$user_filter = $userPreferences['user_filter'];
$status_filter = $userPreferences['status_filter'];