function printView()
    {
        if (empty($this->_person)) {
            return;
        }
        ?>
		<form method="post" class="form-horizontal">
			<input type="hidden" name="new_note_submitted" value="1" />
			<input type="hidden" name="personid" value="<?php 
        echo $this->_person->id;
        ?>
" />
			<h3>New Note Details</h3>
			<?php 
        $this->_note->printForm();
        ?>
	
			<div class="controls">
				<button type="submit" class="btn">Add Note to Person</button>
				<a class="btn" href="<?php 
        echo build_url(array('view' => 'persons', 'personid' => $this->_person->id));
        ?>
">Cancel</a>
		</form>
		<?php 
    }
Ejemplo n.º 2
0
    public function Hierarchy($items, $separator = '&raquo;', $class = 'hierarchy-breadcrumb')
    {
        if ($class) {
            echo '<div class="hierarchy-breadcrumb">';
        }
        $sep = '';
        foreach ($items as $item) {
            $controller = mb_strtolower(get_class($item));
            $action = 'edit';
            $title = $item->title;
            switch ($controller) {
                case 'client':
                case 'project':
                    $action = 'view';
                    break;
            }
            $url = build_url($controller, $action, array('id' => $item->id));
            ?>
			<?php 
            echo $sep;
            ?>
 <span class="breadcrumb-entry"><a href="<?php 
            echo $url;
            ?>
"><?php 
            $this->view->o($title);
            ?>
</a></span> 
			<?php 
            $sep = $separator;
        }
        if ($class) {
            echo '</div>';
        }
    }
    function printView()
    {
        ?>
		<form method="post" id="add-family">
			<input type="hidden" name="new_person_submitted" value="1" />
			<input type="hidden" name="familyid" value="<?php 
        echo ents($_REQUEST['familyid']);
        ?>
" />
			<h3>New Person Details</h3>
			<?php 
        $this->_person->printForm();
        if ($chooser = Action_Plan::getMultiChooser('execute_plan', 'add_person')) {
            ?>
				<h3>Action Plans</h3>
				<p>Execute the following action plans for the new person:</p>
				<?php 
            echo $chooser;
            ?>
				<p>Reference date for plans: <?php 
            print_widget('plan_reference_date', array('type' => 'date'), NULL);
            ?>
</p>
				<?php 
        }
        ?>
			<button type="submit" class="btn">Add Family Member</button>
			<a href="<?php 
        echo build_url(array('view' => 'families'));
        ?>
" class="btn">Cancel</a>
		</form>
		<?php 
    }
Ejemplo n.º 4
0
 /**
  * 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');
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('downloads');
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'max';
     $max = get_param_integer('max', 10);
     if ($max < 1) {
         $max = 1;
     }
     $start = get_param_integer('start', 0);
     $rows = $GLOBALS['SITE_DB']->query_select('download_downloads', array('*'), array('validated' => 1), 'ORDER BY num_downloads DESC', $max, $start);
     $content = new ocp_tempcode();
     foreach ($rows as $i => $row) {
         if ($i != 0) {
             $content->attach(do_template('BLOCK_SEPARATOR'));
         }
         $content->attach(get_download_html($row, true, true, $zone));
     }
     $page_num = intval(floor(floatval($start) / floatval($max))) + 1;
     $count = $GLOBALS['SITE_DB']->query_value('download_downloads', 'COUNT(*)', array('validated' => 1));
     $num_pages = intval(ceil(floatval($count) / floatval($max)));
     if ($num_pages == 0) {
         $page_num = 0;
     }
     $previous_url = $start == 0 ? new ocp_tempcode() : build_url(array('page' => '_SELF', 'start' => $start - $max), '_SELF');
     $next_url = $page_num == $num_pages ? new ocp_tempcode() : build_url(array('page' => '_SELF', 'start' => $start + $max), '_SELF');
     $browse = do_template('NEXT_BROWSER_BROWSE_NEXT', array('_GUID' => '15ca70ec400629f67edefa869fb1f1a8', 'NEXT_LINK' => $next_url, 'PREVIOUS_LINK' => $previous_url, 'PAGE_NUM' => integer_format($page_num), 'NUM_PAGES' => integer_format($num_pages)));
     return do_template('BLOCK_MAIN_DOWNLOAD_TEASE', array('_GUID' => 'a164e33c0b4ace4bae945c39f2f00ca9', 'CONTENT' => $content, 'BROWSE' => $browse));
 }
Ejemplo n.º 5
0
Archivo: auth.php Proyecto: jeena/Quill
function normalizeMeURL($url)
{
    $me = parse_url($url);
    if (array_key_exists('path', $me) && $me['path'] == '') {
        return false;
    }
    // parse_url returns just "path" for naked domains
    if (count($me) == 1 && array_key_exists('path', $me)) {
        $me['host'] = $me['path'];
        unset($me['path']);
    }
    if (!array_key_exists('scheme', $me)) {
        $me['scheme'] = 'http';
    }
    if (!array_key_exists('path', $me)) {
        $me['path'] = '/';
    }
    // Invalid scheme
    if (!in_array($me['scheme'], array('http', 'https'))) {
        return false;
    }
    // Invalid path
    if ($me['path'] != '/') {
        return false;
    }
    // query and fragment not allowed
    if (array_key_exists('query', $me) || array_key_exists('fragment', $me)) {
        return false;
    }
    return build_url($me);
}
Ejemplo n.º 6
0
 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     require_lang('activities');
     require_code('activities');
     list(, $whereville) = find_activities(get_member(), $_filters == '' ? 'all' : 'some_members', $_filters == '' ? NULL : array_map('intval', explode(',', $_filters)));
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'activities WHERE (' . $whereville . ') AND a_time>' . strval($cutoff) . ' ORDER BY a_time DESC', $max, 0);
     $content = new ocp_tempcode();
     foreach ($rows as $row) {
         $id = strval($row['id']);
         $author = $GLOBALS['FORUM_DRIVER']->get_username($row['a_member_id']);
         if (is_null($author)) {
             $author = do_lang('UNKNOWN');
         }
         $news_date = date($date_string, $row['a_time']);
         $edit_date = '';
         list($_title, ) = render_activity($row);
         $news_title = xmlentities($_title->evaluate());
         $summary = xmlentities('');
         $news = '';
         $category = '';
         $category_raw = '';
         $view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $row['a_member_id']), get_module_zone('members'), NULL, false, false, true);
         $if_comments = new ocp_tempcode();
         $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
     }
     return array($content, do_lang('ACTIVITIES_TITLE'));
 }
    public function printView()
    {
        if (!$this->_new_object->id && !empty($_REQUEST['categoryid'])) {
            $cat = $GLOBALS['system']->getDBObject('service_component_category', (int) $_REQUEST['categoryid']);
            if ($cat) {
                $this->_new_object->setValue('categoryid', array_get($_REQUEST, 'categoryid'));
                foreach (array('length_mins', 'show_in_handout', 'show_on_slide') as $k) {
                    $this->_new_object->setValue($k, $cat->getValue($k . '_default'));
                }
            }
        }
        ?>
		<form method="post" class="form-horizontal" id="add-<?php 
        echo $this->_create_type;
        ?>
">
			<input type="hidden" name="new_<?php 
        echo $this->_create_type;
        ?>
_submitted" value="1" />
			<?php 
        $this->_new_object->printForm();
        ?>
			<hr />
			<div class="controls">
				<input class="btn" type="submit" value="Save" />
				<input class="btn" name="create_another" type="submit" value="Save and add another" />
				<a href="<?php 
        echo build_url(array('view' => 'services__service_components'));
        ?>
" class="btn">Cancel</a>
			</div>
		</form>
		<?php 
    }
Ejemplo n.º 8
0
 /**
  * Standard modular run function for OcCLE notification hooks.
  *
  * @param  ?integer	The "current" time on which to base queries (NULL: now)
  * @return ~array		Array of section, type and message responses (false: nothing)
  */
 function run($timestamp = NULL)
 {
     if (!addon_installed('chat')) {
         return false;
     }
     if (!is_null(get_value('occle_watched_chatroom'))) {
         require_lang('chat');
         if (is_null($timestamp)) {
             $timestamp = time();
         }
         $room = intval(get_value('occle_watched_chatroom'));
         $room_messages = $GLOBALS['SITE_DB']->query('SELECT COUNT(*) AS cnt FROM ' . get_table_prefix() . 'chat_messages WHERE room_id=' . strval($room) . ' AND date_and_time>=' . strval((int) $timestamp));
         if (!array_key_exists(0, $room_messages)) {
             return false;
         }
         if ($room_messages[0]['cnt'] > 0) {
             $rooms = array();
             $messages = $room_messages[0]['cnt'];
             $room_data = $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'room_name', array('id' => $room));
             if (is_null($room_data)) {
                 return false;
             }
             // Selected room deleted
             $rooms[$room_data] = build_url(array('page' => 'chat', 'type' => 'room', 'id' => $room), get_module_zone('chat'));
             return array(do_lang('SECTION_CHAT'), do_lang('NEW_MESSAGES'), do_template('OCCLE_CHAT_NOTIFICATION', array('MESSAGE_COUNT' => integer_format($messages), 'ROOMS' => $rooms)));
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
    function printView()
    {
        ?>
		<form method="post" class="form-horizontal" id="add-<?php 
        echo $this->_create_type;
        ?>
">
			<input type="hidden" name="new_<?php 
        echo $this->_create_type;
        ?>
_submitted" value="1" />
			<?php 
        $this->_new_object->printForm();
        ?>
			<div class="controls">
				<input class="btn" type="submit" value="Save and view group" />
				<input class="btn" name="create_another" type="submit" value="Save group and create another" />
				<a href="<?php 
        echo build_url(array('view' => 'groups__list_all'));
        ?>
" class="btn">Cancel</a>
			</div>
		</form>
		<?php 
    }
Ejemplo n.º 10
0
 /**
  * Standard modular run function.
  *
  * @return array		An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
  */
 function run()
 {
     if (!addon_installed('backup')) {
         return array();
     }
     if (get_option('backup_time', true) == '') {
         return array();
     }
     $limit_hours = intval(get_option('backup_time', true));
     require_lang('backups');
     $date = intval(get_value('last_backup'));
     $seconds_ago = mixed();
     if ($date != 0) {
         $seconds_ago = time() - $date;
         $status = intval($seconds_ago) > $limit_hours * 60 * 60 ? 0 : 1;
     } else {
         $status = 0;
     }
     $_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
     $config_row = $GLOBALS['SITE_DB']->query_select('config', array('the_page', 'section'), array('the_name' => 'backup_time'), '', 1);
     if (array_key_exists(0, $config_row)) {
         $_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => $config_row[0]['the_page']), get_module_zone('admin_config'));
         $config_url = $_config_url->evaluate();
         $config_url .= '#group_' . $config_row[0]['section'];
     } else {
         $config_url = NULL;
     }
     $url = build_url(array('page' => 'admin_backup', 'type' => 'misc'), 'adminzone');
     list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
     $tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '432685ec6c9f7548ce8b488b6ce00030', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('BACKUP'), 'INFO' => $info));
     return array(array($tpl, $seconds_due_in, NULL, 'backup_time'));
 }
Ejemplo n.º 11
0
 /**
  * Standard modular run function.
  *
  * @return array		An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
  */
 function run()
 {
     if (!addon_installed('iotds')) {
         return array();
     }
     if (get_option('iotd_update_time') == '') {
         return array();
     }
     require_lang('iotds');
     $date = $GLOBALS['SITE_DB']->query_value_null_ok('iotd', 'date_and_time', array('is_current' => 1));
     $limit_hours = intval(get_option('iotd_update_time'));
     $seconds_ago = mixed();
     if (!is_null($date)) {
         $seconds_ago = time() - $date;
         $status = $seconds_ago > $limit_hours * 60 * 60 ? 0 : 1;
     } else {
         $status = 0;
     }
     $_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
     $config_row = $GLOBALS['SITE_DB']->query_select('config', array('the_page', 'section'), array('the_name' => 'iotd_update_time'), '', 1);
     if (array_key_exists(0, $config_row)) {
         $_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => $config_row[0]['the_page']), get_module_zone('admin_config'));
         $config_url = $_config_url->evaluate();
         $config_url .= '#group_' . $config_row[0]['section'];
     } else {
         $config_url = NULL;
     }
     $url = build_url(array('page' => 'cms_iotds', 'type' => 'ed'), get_module_zone('cms_iotds'));
     $num_queue = $this->get_num_iotd_queue();
     list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
     $info->attach(do_lang_tempcode('NUM_QUEUE', integer_format($num_queue)));
     $tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '5c55aed7bedca565c8aa553548b88e64', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('PT_choose_iotd'), 'INFO' => $info));
     return array(array($tpl, $seconds_due_in, NULL, 'iotd_update_time'));
 }
Ejemplo n.º 12
0
 /**
  * Standard modular run function for award hooks. Renders a content box for an award/randomisation.
  *
  * @param  array		The database row for the content
  * @param  ID_TEXT	The zone to display in
  * @return tempcode	Results
  */
 function run($row, $zone)
 {
     $url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), $zone);
     $title = get_translated_tempcode($row['title']);
     $title_plain = get_translated_text($row['title']);
     $news_cat_rows = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title', 'nc_img'), array('id' => $row['news_category']), '', 1);
     if (!array_key_exists(0, $news_cat_rows)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $news_cat_row = $news_cat_rows[0];
     $category = get_translated_text($news_cat_row['nc_title']);
     $img = find_theme_image($news_cat_row['nc_img']);
     if ($row['news_image'] != '') {
         $img = $row['news_image'];
         if (url_is_local($img)) {
             $img = get_base_url() . '/' . $img;
         }
     }
     $news = get_translated_tempcode($row['news']);
     if ($news->is_empty()) {
         $news = get_translated_tempcode($row['news_article']);
         $truncate = true;
     } else {
         $truncate = false;
     }
     $author_url = addon_installed('authors') ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $row['author']), get_module_zone('authors')) : new ocp_tempcode();
     $author = $row['author'];
     require_css('news');
     $seo_bits = seo_meta_get_for('news', strval($row['id']));
     $map = array('_GUID' => 'jd89f893jlkj9832gr3uyg2u', 'TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'TRUNCATE' => $truncate, 'AUTHOR' => $author, 'BLOG' => false, 'AUTHOR_URL' => $author_url, 'CATEGORY' => $category, 'IMG' => $img, 'NEWS' => $news, 'ID' => strval($row['id']), 'SUBMITTER' => strval($row['submitter']), 'DATE' => get_timezoned_date($row['date_and_time']), 'DATE_RAW' => strval($row['date_and_time']), 'FULL_URL' => $url, 'NEWS_TITLE' => $title, 'NEWS_TITLE_PLAIN' => $title_plain);
     if (get_option('is_on_comments') == '1' && !has_no_forum() && $row['allow_comments'] >= 1) {
         $map['COMMENT_COUNT'] = '1';
     }
     return put_in_standard_box(do_template('NEWS_PIECE_SUMMARY', $map));
 }
    function printView()
    {
        ?>
		<form method="post" class="form-horizontal">
			<input type="hidden" name="new_note_submitted" value="1" />
			<input type="hidden" name="familyid" value="<?php 
        echo ents($_REQUEST['familyid']);
        ?>
" />
			<h3><?php 
        echo _('New Note Details');
        ?>
</h3>
			<?php 
        $this->_note->printForm();
        ?>
			<div class="controls">
				<button type="submit" class="btn"><?php 
        _('Add Note to Family');
        ?>
</button>
				<a class="btn" href="<?php 
        echo build_url(array('view' => 'families', 'familyid' => $this->_family->id));
        ?>
">Cancel</a>
		</form>
		<?php 
    }
Ejemplo n.º 14
0
 /**
  * Standard modular run function for award hooks. Renders a content box for an award/randomisation.
  *
  * @param  array		The database row for the content
  * @param  ID_TEXT	The zone to display in
  * @return tempcode	Results
  */
 function run($row, $zone)
 {
     unset($zone);
     require_code('ocf_groups');
     $url = build_url(array('page' => 'groups', 'type' => 'view', 'id' => $row['id']), get_module_zone('groups'));
     return put_in_standard_box(do_template('SIMPLE_PREVIEW_BOX', array('SUMMARY' => get_translated_text($row['g_name'], $GLOBALS['FORUM_DB']), 'URL' => $url)), ocf_get_group_name($row['id']));
 }
Ejemplo n.º 15
0
 /**
  * Standard modular run function.
  *
  * @return array		An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
  */
 function run()
 {
     if (!addon_installed('tickets')) {
         return array();
     }
     require_lang('tickets');
     require_code('tickets');
     require_code('tickets2');
     $outstanding = 0;
     $tickets = get_tickets(get_member(), NULL, false, true);
     if (!is_null($tickets)) {
         foreach ($tickets as $topic) {
             if ($topic['closed'] == 0) {
                 $outstanding++;
             }
         }
     }
     if ($outstanding > 0) {
         $status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0', array('_GUID' => 'g578142633c6f3d37776e82a869deb91'));
     } else {
         $status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1', array('_GUID' => 'h578142633c6f3d37776e82a869deb91'));
     }
     $url = build_url(array('page' => 'tickets', 'type' => 'misc'), get_module_zone('tickets'));
     $tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('URL' => $url, 'STATUS' => $status, 'TASK' => do_lang_tempcode('SUPPORT_TICKETS'), 'INFO' => do_lang_tempcode('NUM_QUEUE', escape_html(integer_format($outstanding)))));
     return array(array($tpl, NULL, $outstanding, NULL));
 }
Ejemplo n.º 16
0
    function printView()
    {
        if ($this->_roster_view) {
            $this->_roster_view->printView(NULL, NULL, FALSE, TRUE);
        } else {
            ?>
			<ul>
			<?php 
            $views = $GLOBALS['system']->getDBObjectData('roster_view', array('is_public' => TRUE), 'AND', 'name');
            foreach ($views as $id => $detail) {
                ?>
				<li><a href="<?php 
                echo build_url(array('roster_view' => $id));
                ?>
"><?php 
                echo ents($detail['name']);
                ?>
</a></li>
				<?php 
            }
            ?>
			</ul>
			<?php 
        }
    }
Ejemplo n.º 17
0
 /**
  * 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)));
 }
Ejemplo n.º 18
0
 /**
  * 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;
 }
Ejemplo n.º 19
0
 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     require_lang('leader_board');
     require_code('points');
     require_css('points');
     $title = get_page_title('POINT_LEADERBOARD');
     $start_date = intval(get_option('leaderboard_start_date'));
     $weeks = $GLOBALS['SITE_DB']->query('SELECT DISTINCT date_and_time FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'leader_board WHERE date_and_time>=' . strval($start_date) . ' ORDER BY date_and_time DESC');
     if (count($weeks) == 0) {
         warn_exit(do_lang_tempcode('NO_ENTRIES'));
     }
     $first_week = $weeks[count($weeks) - 1]['date_and_time'];
     $weeks = collapse_1d_complexity('date_and_time', $weeks);
     $out = new ocp_tempcode();
     foreach ($weeks as $week) {
         $rows = collapse_2d_complexity('lb_member', 'lb_points', $GLOBALS['SITE_DB']->query_select('leader_board', array('lb_member', 'lb_points'), array('date_and_time' => $week)));
         $week_tpl = new ocp_tempcode();
         foreach ($rows as $member => $points) {
             $points_url = build_url(array('page' => 'points', 'type' => 'member', 'id' => $member), get_module_zone('points'));
             $profile_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($member, false, true);
             $name = $GLOBALS['FORUM_DRIVER']->get_username($member);
             if (is_null($name)) {
                 $name = do_lang('UNKNOWN');
             }
             $week_tpl->attach(do_template('POINTS_LEADERBOARD_ROW', array('_GUID' => '6d323b4b5abea0e82a14cb4745c4af4f', 'POINTS_URL' => $points_url, 'PROFILE_URL' => $profile_url, 'POINTS' => integer_format($points), 'NAME' => $name, 'ID' => strval($member))));
         }
         $nice_week = intval(($week - $first_week) / (7 * 24 * 60 * 60) + 1);
         $out->attach(do_template('POINTS_LEADERBOARD_WEEK', array('_GUID' => '3a0f71bf20f9098e5711e85cf25f6549', 'WEEK' => integer_format($nice_week), 'ROWS' => $week_tpl)));
     }
     return do_template('POINTS_LEADERBOARD_SCREEN', array('_GUID' => 'bab5f7b661435b83800532d3eebd0d54', 'TITLE' => $title, 'WEEKS' => $out));
 }
Ejemplo n.º 20
0
 function go_back($suffix = NULL, $default = NULL)
 {
     //获取来源
     $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     //判断来源
     if (!empty($referer)) {
         // 来自Typecho
         if (!empty($suffix)) {
             $parts = parse_url($referer);
             $myParts = parse_url($suffix);
             if (isset($myParts['fragment'])) {
                 $parts['fragment'] = $myParts['fragment'];
             }
             if (isset($myParts['query'])) {
                 $args = array();
                 if (isset($parts['query'])) {
                     parse_str($parts['query'], $args);
                 }
                 parse_str($myParts['query'], $currentArgs);
                 $args = array_merge($args, $currentArgs);
                 $parts['query'] = http_build_query($args);
             }
             $referer = build_url($parts);
         }
         redirect($referer);
     } else {
         if (!empty($default)) {
             redirect($default);
         }
     }
 }
Ejemplo n.º 21
0
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'polls')) {
         $rows = $GLOBALS['SITE_DB']->query('SELECT b.option1,b.option2,b.option3,b.option4,b.option5,b.option6,b.option7,b.option8,b.option9,b.option10,b.votes1,b.votes2,b.votes3,b.votes4,b.votes5,b.votes6,b.votes7,b.votes8,b.votes9,b.votes10,b.question,b.id,b.submitter AS member_id,a.date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll a LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll b ON a.date_and_time>b.date_and_time WHERE NOT EXISTS(SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll x WHERE x.id<>a.id AND x.id<>b.id AND x.date_and_time BETWEEN b.date_and_time AND a.date_and_time) AND b.date_and_time IS NOT NULL AND b.date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         foreach ($rows as $row) {
             require_lang('polls');
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $best = NULL;
             $best_num = -1;
             for ($i = 1; $i <= 10; $i++) {
                 if ($row['votes' . strval($i)] > $best_num) {
                     $best = $row['option' . strval($i)];
                     $best_num = $row['votes' . strval($i)];
                 }
             }
             if ($best_num == -1) {
                 continue;
             }
             $ticker_text = do_lang('VOTES_ARE_IN', strip_comcode(get_translated_text($row['question'])), strip_comcode(get_translated_text($best)));
             $drops[] = rain_get_special_icons(NULL, $timestamp, NULL, $ticker_text) + array('TYPE' => 'polls', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title(get_translated_text($row['question'])), 'IMAGE' => find_theme_image('bigicons/polls'), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $ticker_text, 'URL' => build_url(array('page' => 'polls', 'type' => 'view', 'id' => $row[1]['id']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'poll_' . strval($row['id']));
         }
     }
     return $drops;
 }
Ejemplo n.º 22
0
 /**
  * @dataProvider build_url_test_data
  */
 public function test_build_url($page, $strip_vars, $expected)
 {
     global $user, $phpbb_root_path;
     $user->page['page'] = $page;
     $output = build_url($strip_vars);
     $this->assertEquals($expected, $output);
 }
Ejemplo n.º 23
0
 /**
  * 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)));
 }
Ejemplo n.º 24
0
 /**
  * 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;
 }
Ejemplo n.º 25
0
 /**
  * Standard modular run function.
  *
  * @return array		An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
  */
 function run()
 {
     if (!addon_installed('flagrant')) {
         return array();
     }
     require_lang('flagrant');
     $rows = $GLOBALS['SITE_DB']->query_select('text', array('activation_time', 'days'), array('active_now' => 1), '', NULL, NULL, true);
     if (is_null($rows)) {
         return array();
     }
     $seconds_due_in = mixed();
     if (array_key_exists(0, $rows)) {
         $activation_time = $rows[0]['activation_time'];
         $days = $rows[0]['days'];
         $date = $activation_time + $days * 24 * 60 * 60;
         $seconds_due_in = $date - time();
         $status = $seconds_due_in <= 0 ? 0 : 1;
     } else {
         $status = 1;
     }
     $_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
     $url = build_url(array('page' => 'admin_flagrant', 'type' => 'misc'), 'adminzone');
     $num_queue = $this->get_num_flagrant_queue();
     list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_due_in);
     $info->attach(do_lang_tempcode('NUM_QUEUE', escape_html(integer_format($num_queue))));
     $tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '820e0e3cd80754dc7dfd9a0d05a43ec0', 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('CHOOSE_FLAGRANT'), 'INFO' => $info));
     return array(array($tpl, $seconds_due_in, NULL, NULL));
 }
Ejemplo n.º 26
0
 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     if (!addon_installed('galleries')) {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'galleries')) {
         return NULL;
     }
     $filters_1 = ocfilter_to_sqlfragment($_filters, 'name', 'galleries', 'parent_id', 'name', 'name', false, false);
     // 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)
     $filters = ocfilter_to_sqlfragment($_filters, 'cat', 'galleries', 'parent_id', 'cat', 'name', false, false);
     // 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)
     require_lang('galleries');
     $content = new ocp_tempcode();
     $_galleries = array();
     if ($GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'galleries WHERE ' . $filters_1) < 3000) {
         $_galleries = $GLOBALS['SITE_DB']->query('SELECT fullname,name FROM ' . get_table_prefix() . 'galleries WHERE ' . $filters_1);
         foreach ($_galleries as $i => $_gallery) {
             $_galleries[$i]['text_original'] = get_translated_text($_gallery['fullname']);
         }
     }
     $galleries = collapse_2d_complexity('name', 'text_original', $_galleries);
     $rows1 = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'videos WHERE add_date>' . strval((int) $cutoff) . ' AND ' . $filters . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' ORDER BY add_date DESC', $max);
     $rows2 = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'images WHERE add_date>' . strval((int) $cutoff) . ' AND ' . $filters . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' ORDER BY add_date DESC', $max);
     $rows = array_merge($rows1, $rows2);
     foreach ($rows as $row) {
         $id = strval($row['id']);
         $author = $GLOBALS['FORUM_DRIVER']->get_username($row['submitter']);
         if (is_null($author)) {
             $author = '';
         }
         $news_date = date($date_string, $row['add_date']);
         $edit_date = is_null($row['edit_date']) ? '' : date($date_string, $row['edit_date']);
         $news_title = xmlentities(do_lang('THIS_WITH_SIMPLE', array_key_exists('video_views', $row) ? do_lang('VIDEO') : do_lang('IMAGE'), strval($row['id'])));
         $_summary = get_translated_tempcode($row['comments']);
         $summary = xmlentities($_summary->evaluate());
         $news = '';
         if (!array_key_exists($row['cat'], $galleries)) {
             $_fullname = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'fullname', array('name' => $row['cat']));
             if (is_null($_fullname)) {
                 continue;
             }
             $galleries[$row['cat']] = get_translated_text($_fullname);
         }
         $category = $galleries[$row['cat']];
         $category_raw = $row['cat'];
         $view_url = build_url(array('page' => 'galleries', 'type' => array_key_exists('video_views', $row) ? 'video' : 'image', 'id' => $row['id']), get_module_zone('galleries'), NULL, false, false, true);
         if ($prefix == 'RSS_' && get_option('is_on_comments') == '1' && $row['allow_comments'] >= '1') {
             $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => '65dc0cec8c75f565c58c95fa1667aa1e', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id'])));
         } else {
             $if_comments = new ocp_tempcode();
         }
         require_code('images');
         $enclosure_url = ensure_thumbnail($row['url'], $row['thumb_url'], 'galleries', array_key_exists('video_views', $row) ? 'videos' : 'images', $row['id']);
         list($enclosure_length, $enclosure_type) = get_enclosure_details($row['url'], $enclosure_url);
         $content->attach(do_template($prefix . 'ENTRY', array('ENCLOSURE_URL' => $enclosure_url, 'ENCLOSURE_LENGTH' => $enclosure_length, 'ENCLOSURE_TYPE' => $enclosure_type, 'VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
     }
     require_lang('galleries');
     return array($content, do_lang('GALLERIES'));
 }
Ejemplo n.º 27
0
 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     if (!addon_installed('cedi')) {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'cedi')) {
         return NULL;
     }
     $filters = ocfilter_to_sqlfragment($_filters, 'id', 'seedy_children', 'parent_id', 'parent_id', 'child_id');
     $content = new ocp_tempcode();
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'seedy_pages WHERE ' . $filters . ' AND add_date>' . strval((int) $cutoff) . ' ORDER BY add_date DESC', $max);
     foreach ($rows as $row) {
         $id = strval($row['id']);
         if (!has_category_access(get_member(), 'seedy_page', strval($row['id']))) {
             continue;
         }
         $author = '';
         $news_date = date($date_string, $row['add_date']);
         $edit_date = '';
         $news_title = xmlentities(escape_html(get_translated_text($row['title'])));
         $_summary = get_translated_tempcode($row['description']);
         $summary = xmlentities($_summary->evaluate());
         $news = '';
         $category = '';
         $category_raw = '';
         $view_url = build_url(array('page' => 'cedi', 'type' => 'misc', 'id' => $row['id'] == db_get_first_id() ? NULL : $row['id']), get_module_zone('cedi'), NULL, false, false, true);
         $if_comments = new ocp_tempcode();
         $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
     }
     require_lang('cedi');
     return array($content, do_lang('CEDI_PAGES'));
 }
Ejemplo n.º 28
0
 /**
  * Standard modular run function for newsletter hooks.
  *
  * @param  TIME				The time that the entries found must be newer than
  * @param  LANGUAGE_NAME	The language the entries found must be in
  * @param  string				Category filter to apply
  * @return array				Tuple of result details
  */
 function run($cutoff_time, $lang, $filter)
 {
     $new = new ocp_tempcode();
     require_code('ocfiltering');
     if ($filter == '') {
         $filter = ',';
     }
     // Just welcome zone
     $or_list = ocfilter_to_sqlfragment($filter, 'b.the_zone', NULL, NULL, NULL, NULL, false);
     $_rows = $GLOBALS['SITE_DB']->query('SELECT a.* FROM ' . get_table_prefix() . 'cached_comcode_pages a JOIN ' . get_table_prefix() . 'comcode_pages b ON a.the_page=b.the_page AND a.the_zone=b.the_zone WHERE p_add_date>' . strval($cutoff_time) . ' AND (' . $or_list . ')', 300);
     if (count($_rows) == 300) {
         return array();
     }
     $rows = array();
     foreach ($_rows as $row) {
         $rows[$row['the_zone'] . ':' . $row['the_page']] = $row;
     }
     $_rows2 = $GLOBALS['SITE_DB']->query_select('seo_meta', array('*'), array('meta_for_type' => 'comcode_page'));
     $rows2 = array();
     foreach ($_rows2 as $row) {
         $rows2[$row['meta_for_id']] = $row;
     }
     $zones = explode(',', $filter);
     //find_all_zones();
     foreach ($zones as $zone) {
         if ($zone == 'cms') {
             continue;
         }
         if ($zone == 'adminzone') {
             continue;
         }
         $pages = find_all_pages($zone, 'comcode_custom/' . get_site_default_lang(), 'txt', false, $cutoff_time);
         foreach (array_keys($pages) as $page) {
             if (!is_string($page)) {
                 $page = strval($page);
             }
             // PHP can be weird when things like '404' are put in arrays
             if (substr($page, 0, 6) == 'panel_') {
                 continue;
             }
             $id = $zone . ':' . $page;
             $_url = build_url(array('page' => $page), $zone, NULL, false, false, true);
             $url = $_url->evaluate();
             $name = ucfirst(str_replace('_', ' ', $page));
             if (array_key_exists($id, $rows)) {
                 $_name = get_translated_text($rows[$id]['cc_page_title'], NULL, NULL, true);
                 if (!is_null($_name)) {
                     $name = $_name;
                 }
             }
             $description = '';
             $member_id = NULL;
             if (array_key_exists($id, $rows2)) {
                 $description = get_translated_text($rows2[$id]['meta_description']);
             }
             $new->attach(do_template('NEWSLETTER_NEW_RESOURCE_FCOMCODE', array('_GUID' => '67f165847dacd54d2965686d561b57ee', 'MEMBER_ID' => $member_id, 'URL' => $url, 'NAME' => $name, 'DESCRIPTION' => $description)));
         }
     }
     return array($new, do_lang('PAGES', '', '', '', $lang));
 }
Ejemplo n.º 29
0
 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     require_lang('bulkupload');
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/bulkuploadassistant';
     $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_adv_comcode';
     $GLOBALS['HELPER_PANEL_TEXT'] = comcode_lang_string('DOC_BULK_UPLOAD');
     $title = get_page_title('BULK_UPLOAD');
     $parameter = post_param('parameter', '');
     require_code('form_templates');
     if ($parameter == '') {
         $post_url = build_url(array('page' => '_SELF'), '_SELF');
         $text = paragraph(do_lang_tempcode('BULK_UPLOAD_HELP'));
         $submit_name = do_lang_tempcode('BULK_UPLOAD');
         $fields = form_input_line(do_lang_tempcode('DIRECTORY'), do_lang_tempcode('DIRECTORY_BULK'), 'parameter', 'uploads/attachments/' . date('Y-m-d', utctime_to_usertime()), true);
         return do_template('FORM_SCREEN', array('_GUID' => '77a2ca460745145d8a1d18cf24971fea', 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'FIELDS' => $fields, 'URL' => $post_url, 'TITLE' => $title, 'TEXT' => $text, 'SUBMIT_NAME' => $submit_name));
     } else {
         breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('BULK_UPLOAD'))));
         breadcrumb_set_self(do_lang_tempcode('_RESULTS'));
         $out = $this->do_dir(get_custom_file_base() . '/' . filter_naughty($parameter, true));
         if ($out->is_empty()) {
             inform_exit(do_lang_tempcode('NO_FILES'));
         }
         return do_template('BULK_HELPER_RESULTS_SCREEN', array('_GUID' => '5d373553cf21a58f15006bd4e600a9ee', 'TITLE' => $title, 'RESULTS' => $out));
     }
 }
    function printView()
    {
        if ($this->_roster_view) {
            $end_date = NULL;
            if (!empty($_REQUEST['weeks'])) {
                $end_date = date('Y-m-d', strtotime('+' . ((int) $_REQUEST['weeks'] * 7 + 1) . ' days'));
            }
            $this->_roster_view->printView(NULL, $end_date, FALSE, TRUE);
        } else {
            ?>
			<ul>
			<?php 
            $views = $GLOBALS['system']->getDBObjectData('roster_view', array('is_public' => TRUE), 'AND', 'name');
            foreach ($views as $id => $detail) {
                ?>
				<li><a href="<?php 
                echo build_url(array('roster_view' => $id));
                ?>
"><?php 
                echo ents($detail['name']);
                ?>
</a></li>
				<?php 
            }
            ?>
			</ul>
			<?php 
        }
    }