本文整理汇总了PHP中phemplate::drop_loop方法的典型用法代码示例。如果您正苦于以下问题:PHP phemplate::drop_loop方法的具体用法?PHP phemplate::drop_loop怎么用?PHP phemplate::drop_loop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phemplate
的用法示例。
在下文中一共展示了phemplate::drop_loop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rawurlencode
$topass['message']['type'] = MESSAGE_ERROR;
$topass['message']['text'] = $GLOBALS['_lang'][6];
redirect2page('info.php', $topass);
}
$output['lang_256'] = sanitize_and_format($GLOBALS['_lang'][256], TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
$output['return2me'] = 'photo_view.php';
if (!empty($_SERVER['QUERY_STRING'])) {
$output['return2me'] .= '?' . $_SERVER['QUERY_STRING'];
}
$output['return2me'] = rawurlencode($output['return2me']);
$output['return2'] = sanitize_and_format_gpc($_GET, 'return', TYPE_STRING, $__field2format[FIELD_TEXTFIELD], '');
$output['return'] = rawurlencode($output['return2']);
$tpl->set_file('content', 'photo_view.html');
$tpl->set_var('output', $output);
$tpl->set_loop('loop_comments', $loop_comments);
$tpl->set_var('tplvars', $tplvars);
$tpl->process('content', 'content', TPL_LOOP | TPL_OPTLOOP | TPL_OPTIONAL);
$tpl->drop_loop('loop_comments');
unset($loop_comments);
$tplvars['title'] = sprintf($GLOBALS['_lang'][143], $output['user']);
$tplvars['page_title'] = sprintf($GLOBALS['_lang'][143], '<a href="' . $tplvars['relative_url'] . 'photo_search.php?st=user&uid=' . $output['fk_user_id'] . '">' . $output['user'] . '</a>');
$tplvars['page'] = 'photo_view';
$tplvars['css'] = 'photo_view.css';
if (is_file('photo_view_left.php')) {
include 'photo_view_left.php';
}
include 'frame.php';
if (!empty($photo_id) && isset($output['fk_user_id']) && (!empty($_SESSION[_LICENSE_KEY_]['user']['user_id']) && $output['fk_user_id'] != $_SESSION[_LICENSE_KEY_]['user']['user_id'] || empty($_SESSION[_LICENSE_KEY_]['user']['user_id']))) {
$query = "UPDATE `{$dbtable_prefix}user_photos` SET `stat_views`=`stat_views`+1 WHERE `photo_id`={$photo_id}";
@mysql_query($query);
}
示例2: array
trigger_error(mysql_error(), E_USER_ERROR);
}
$i = 0;
$access_levels = array();
while ($rsrow = mysql_fetch_assoc($res)) {
$rsrow['level_code'] = sanitize_and_format($rsrow['level_code'], TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
$rsrow['level_diz'] = sanitize_and_format($rsrow['level_diz'], TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
$access_levels[$i]['row'] = '<td><a href="access_levels_addedit.php?level_id=' . $rsrow['level_id'] . '" title="' . $rsrow['level_diz'] . '">' . $rsrow['level_code'] . "</a></td>\n";
for ($j = 0; isset($memberships[$j]); ++$j) {
$access_levels[$i]['row'] .= '<td><input type="checkbox" name="levels[' . $rsrow['level_id'] . '][' . $memberships[$j]['m_value'] . ']" value="1"';
if ((int) $memberships[$j]['m_value'] & (int) $rsrow['level']) {
$access_levels[$i]['row'] .= ' checked="checked"';
}
if ((int) $memberships[$j]['m_value'] & (int) $rsrow['disabled_level']) {
$access_levels[$i]['row'] .= ' disabled="disabled"';
}
$access_levels[$i]['row'] .= " /></td>\n";
}
++$i;
}
$tpl->set_file('content', 'access_levels.html');
$tpl->set_loop('access_levels', $access_levels);
$tpl->set_loop('memberships', $memberships);
$tpl->process('content', 'content', TPL_LOOP | TPL_NOLOOP);
$tpl->drop_loop('access_levels');
$tpl->drop_loop('memberships');
unset($access_levels);
unset($memberships);
$tplvars['title'] = 'Define access levels';
$tplvars['page'] = 'access_levels';
include 'frame.php';
示例3: phemplate
//define('CACHE_LIMITER','private');
require 'includes/common.inc.php';
require _BASEPATH_ . '/includes/user_functions.inc.php';
check_login_member('search_advanced');
$tpl = new phemplate(_BASEPATH_ . '/skins_site/' . get_my_skin() . '/', 'remove_nonjs');
$search_fields = array();
foreach ($_pcats as $pcat_id => $pcat) {
if ((int) $pcat['access_level'] & (int) $_SESSION[_LICENSE_KEY_]['user']['membership']) {
for ($i = 0; isset($pcat['fields'][$i]); ++$i) {
if (isset($_pfields[$pcat['fields'][$i]]->config['searchable'])) {
$search_fields[] = $pcat['fields'][$i];
}
}
}
}
sort($search_fields, SORT_NUMERIC);
$search_loop = create_search_form($search_fields);
$tpl->set_file('content', 'search_more.html');
$tpl->set_loop('search', $search_loop);
$tpl->process('content', 'content', TPL_LOOP);
$tpl->drop_loop('search');
unset($search_loop);
$tplvars['title'] = $GLOBALS['_lang'][247];
$tplvars['page_title'] = $GLOBALS['_lang'][247];
$tplvars['page'] = 'search_more';
$tplvars['css'] = 'search_more.css';
if (is_file('search_more_left.php')) {
include 'search_more_left.php';
}
$no_timeout = true;
include 'frame.php';
示例4: array
$totalrows = mysql_result($res, 0, 0);
$countries = array();
if (!empty($totalrows)) {
if ($o >= $totalrows) {
$o = $totalrows - $r;
$o = $o >= 0 ? $o : 0;
}
$query = "SELECT * FROM {$from} WHERE {$where} ORDER BY `country` ASC LIMIT {$o},{$r}";
if (!($res = @mysql_query($query))) {
trigger_error(mysql_error(), E_USER_ERROR);
}
$i = 0;
while ($rsrow = mysql_fetch_assoc($res)) {
$rsrow['country'] = sanitize_and_format($rsrow['country'], TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
$rsrow['prefered_input'] = $country_prefered_input[$rsrow['prefered_input']];
$rsrow['myclass'] = $i % 2 ? 'odd_item' : 'even_item';
$countries[] = $rsrow;
++$i;
}
$tpl->set_var('pager1', pager($totalrows, $o, $r));
$tpl->set_var('pager2', pager($totalrows, $o, $r));
}
$tpl->set_file('content', 'loc_countries.html');
$tpl->set_loop('countries', $countries);
$tpl->set_var('o', $o);
$tpl->set_var('r', $r);
$tpl->process('content', 'content', TPL_LOOP | TPL_NOLOOP);
$tpl->drop_loop('countries');
$tplvars['title'] = 'Location Management: Countries';
$tplvars['page'] = 'loc_countries';
include 'frame.php';
示例5: while
if (!empty($totalrows)) {
if ($o >= $totalrows) {
$o = $totalrows - $r;
$o = $o >= 0 ? $o : 0;
}
$query = "SELECT * FROM {$from} WHERE {$where} ORDER BY `admin_id` ASC LIMIT {$o},{$r}";
if (!($res = @mysql_query($query))) {
trigger_error(mysql_error(), E_USER_ERROR);
}
$i = 0;
while ($rsrow = mysql_fetch_assoc($res)) {
$rsrow['name'] = sanitize_and_format($rsrow['name'], TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
$rsrow['status'] = $accepted_astats[$rsrow['status']];
$rsrow['dept_id'] = $accepted_admin_depts[$rsrow['dept_id']];
$rsrow['myclass'] = $i % 2 ? 'odd_item' : 'even_item';
$admin_accounts[] = $rsrow;
++$i;
}
$tpl->set_var('pager1', pager($totalrows, $o, $r));
$tpl->set_var('pager2', pager($totalrows, $o, $r));
}
$tpl->set_file('content', 'admin_accounts.html');
$tpl->set_loop('admin_accounts', $admin_accounts);
$tpl->set_var('o', $o);
$tpl->set_var('r', $r);
$tpl->process('content', 'content', TPL_LOOP | TPL_NOLOOP);
$tpl->drop_loop('admin_accounts');
unset($admin_accounts);
$tplvars['title'] = 'Admin Accounts';
$tplvars['page'] = 'admin_accounts';
include 'frame.php';
示例6: array
$networks = array();
$i = 0;
while ($rsrow = mysql_fetch_assoc($res)) {
$rsrow['network'] = sanitize_and_format($rsrow['network'], TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
$net_members = get_network_members($_SESSION[_LICENSE_KEY_]['user']['user_id'], $rsrow['net_id'], 4);
if (!empty($net_members)) {
$rsrow['members'] = $user_cache->get_cache_tpl($net_members, 'result_user');
}
if (!empty($rsrow['members'])) {
$rsrow['see_all'] = true;
$networks[] = $rsrow;
}
}
$output = array();
$output['user_id'] = $_SESSION[_LICENSE_KEY_]['user']['user_id'];
$tpl->set_file('content', 'my_networks.html');
$tpl->set_var('output', $output);
$tpl->set_loop('networks', $networks);
$tpl->process('content', 'content', TPL_MULTILOOP | TPL_OPTLOOP | TPL_NOLOOP);
$tpl->drop_loop('networks');
unset($networks);
$tplvars['title'] = $GLOBALS['_lang'][240];
$tplvars['page_title'] = $GLOBALS['_lang'][240];
$tplvars['page'] = 'my_networks';
$tplvars['css'] = 'my_networks.css';
if (is_file('my_networks_left.php')) {
include 'my_networks_left.php';
}
unset($page_last_modified_time);
// we want everything fresh on this page.
include 'frame.php';
示例7: array
}
$totalrows = mysql_result($res, 0, 0);
$date_format = get_site_option('date_format', 'def_user_prefs');
$subscriptions_auto = array();
if (!empty($totalrows)) {
// create the $pfields helper array for easier access to fields by dbfield
$pfields = array();
foreach ($_pfields as $pfield_id => $pfield) {
if (get_class($pfield) == 'field_select') {
$pfields[$pfield->config['dbfield']]['label'] = $pfield->config['label'];
$pfields[$pfield->config['dbfield']]['accepted_values'] = $pfield->config['accepted_values'];
}
}
$query = "SELECT a.*,UNIX_TIMESTAMP(a.`date_start`) as `date_start`,b.`subscr_name` FROM {$from} WHERE {$where} ORDER BY a.`asubscr_id`";
if (!($res = @mysql_query($query))) {
trigger_error(mysql_error(), E_USER_ERROR);
}
while ($rsrow = mysql_fetch_assoc($res)) {
$rsrow['dbfield'] = empty($rsrow['dbfield']) ? 'All' : 'Having ' . $pfields[$rsrow['dbfield']]['label'] . '(' . $rsrow['dbfield'] . ') = ' . $pfields[$rsrow['dbfield']]['accepted_values'][$rsrow['field_value']];
$rsrow['subscr_name'] = sanitize_and_format($rsrow['subscr_name'], TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
$rsrow['date_start'] = empty($rsrow['date_start']) ? 'Join' : strftime($date_format, $rsrow['date_start']);
$subscriptions_auto[] = $rsrow;
}
}
$tpl->set_file('content', 'subscriptions_auto.html');
$tpl->set_loop('subscriptions_auto', $subscriptions_auto);
$tpl->process('content', 'content', TPL_LOOP | TPL_NOLOOP);
$tpl->drop_loop('subscriptions_auto');
$tplvars['title'] = 'Site Auto Subscriptions';
$tplvars['page'] = 'subscriptions_auto';
include 'frame.php';
示例8: while
if (!($res = @mysql_query($query))) {
trigger_error(mysql_error(), E_USER_ERROR);
}
while ($rsrow = mysql_fetch_assoc($res)) {
$rsrow['currency'] = isset($accepted_currencies[$rsrow['currency']]) ? $accepted_currencies[$rsrow['currency']] : '';
$rsrow['subscr_name'] = sanitize_and_format($rsrow['subscr_name'], TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
if (!empty($rsrow['is_recurent'])) {
$rsrow['is_recurent'] = '<img src="skin/images/refresh.gif" title="Recuring" />';
} else {
unset($rsrow['is_recurent']);
}
if (!empty($rsrow['is_visible'])) {
$rsrow['is_visible'] = '<img src="skin/images/check.gif" />';
} else {
unset($rsrow['is_visible']);
}
if (empty($rsrow['duration'])) {
$rsrow['duration'] = 'Lifetime';
} else {
$rsrow['duration'] .= ' days';
}
$subscriptions[] = $rsrow;
}
}
$tpl->set_file('content', 'subscriptions.html');
$tpl->set_loop('subscriptions', $subscriptions);
$tpl->process('content', 'content', TPL_LOOP | TPL_NOLOOP);
$tpl->drop_loop('subscriptions');
$tplvars['title'] = 'Site Subscriptions';
$tplvars['page'] = 'subscriptions';
include 'frame.php';
示例9: while
$i = 0;
while ($rsrow = mysql_fetch_assoc($res)) {
$rsrow['myclass'] = $i % 2 ? 'odd_item' : 'even_item';
$zipcodes[] = $rsrow;
++$i;
}
$tpl->set_var('pager1', pager($totalrows, $o, $r));
$tpl->set_var('pager2', pager($totalrows, $o, $r));
}
}
$tpl->set_file('content', 'loc_zipcodes.html');
$tpl->set_loop('zipcodes', $zipcodes);
$tpl->set_var('city_id', $city_id);
$tpl->set_var('city', $city);
$tpl->set_var('state_id', $state_id);
$tpl->set_var('state', $state);
$tpl->set_var('country_id', $country_id);
$tpl->set_var('country', $country);
$tpl->set_var('o', $o);
$tpl->set_var('r', $r);
$tpl->set_var('cio', $cio);
$tpl->set_var('cir', $cir);
$tpl->set_var('so', $so);
$tpl->set_var('sr', $sr);
$tpl->set_var('co', $co);
$tpl->set_var('cr', $cr);
$tpl->process('content', 'content', TPL_LOOP | TPL_NOLOOP);
$tpl->drop_loop('zipcodes');
$tplvars['title'] = 'Location Management: Zipcodes';
$tplvars['page'] = 'loc_zipcodes';
include 'frame.php';
示例10: DateMill
File: admin/rate_limiter.php
$Revision$
Software by: DateMill (http://www.datemill.com)
Copyright by: DateMill (http://www.datemill.com)
Support at: http://www.datemill.com/forum
*******************************************************************************
* See the "docs/licenses/etano.txt" file for license. *
******************************************************************************/
require_once '../includes/common.inc.php';
require_once '../includes/admin_functions.inc.php';
require_once '../includes/logs.inc.php';
allow_dept(DEPT_ADMIN);
$tpl = new phemplate('skin/', 'remove_nonjs');
$tpl->set_file('content', 'rate_limiter.html');
$query = "SELECT a.*,b.`m_name` FROM `{$dbtable_prefix}rate_limiter` a,`{$dbtable_prefix}memberships` b WHERE a.`m_value`=b.`m_value`";
if (!($res = @mysql_query($query))) {
trigger_error(mysql_error(), E_USER_ERROR);
}
$i = 0;
$rate_limiter = array();
while ($rsrow = mysql_fetch_assoc($res)) {
$rsrow['punishment'] = isset($accepted_punishments[$rsrow['punishment']]) ? $accepted_punishments[$rsrow['punishment']] : '?';
$rate_limiter[] = $rsrow;
}
$rate_limiter = sanitize_and_format($rate_limiter, TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
$tpl->set_loop('rate_limiter', $rate_limiter);
$tpl->process('content', 'content', TPL_LOOP | TPL_NOLOOP);
$tpl->drop_loop('rate_limiter');
$tplvars['title'] = 'Rate Limiter';
$tplvars['page'] = 'rate_limiter';
include 'frame.php';
示例11: while
$o = $totalrows - $r;
$o = $o >= 0 ? $o : 0;
}
$query = "SELECT `state_id`,`state`,`num_cities` FROM {$from} WHERE {$where} ORDER BY `state` ASC LIMIT {$o},{$r}";
if (!($res = @mysql_query($query))) {
trigger_error(mysql_error(), E_USER_ERROR);
}
$i = 0;
while ($rsrow = mysql_fetch_assoc($res)) {
$rsrow['state'] = sanitize_and_format($rsrow['state'], TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
$rsrow['myclass'] = $i % 2 ? 'odd_item' : 'even_item';
$states[] = $rsrow;
++$i;
}
$tpl->set_var('pager1', pager($totalrows, $o, $r));
$tpl->set_var('pager2', pager($totalrows, $o, $r));
}
}
$tpl->set_file('content', 'loc_states.html');
$tpl->set_loop('states', $states);
$tpl->set_var('country_id', $country_id);
$tpl->set_var('country', $country);
$tpl->set_var('o', $o);
$tpl->set_var('r', $r);
$tpl->set_var('co', $co);
$tpl->set_var('cr', $cr);
$tpl->process('content', 'content', TPL_LOOP | TPL_NOLOOP);
$tpl->drop_loop('states');
$tplvars['title'] = 'Location Management: States';
$tplvars['page'] = 'loc_states';
include 'frame.php';
示例12: regenerate_skin_cache
function regenerate_skin_cache($skin_module_code = '', $last_id = 0)
{
$timeout = 120;
require _BASEPATH_ . '/includes/classes/Cache/Lite.php';
$cache = new Cache_Lite($GLOBALS['_cache_config']);
global $dbtable_prefix, $_pfields, $_pcats, $__field2format;
$tpl = new phemplate(_BASEPATH_ . '/skins_site/', 'remove_nonjs');
if (empty($skin_module_code)) {
$query = "SELECT b.`config_value` as `skin_dir` FROM `{$dbtable_prefix}modules` a,`{$dbtable_prefix}site_options3` b WHERE a.`module_type`=" . MODULE_SKIN . " AND a.`module_code`=b.`fk_module_code` AND b.`config_option`='skin_dir'";
} else {
$query = "SELECT `config_value` as `skin_dir` FROM `{$dbtable_prefix}site_options3` WHERE `config_option`='skin_dir' AND `fk_module_code`='{$skin_module_code}'";
}
if (!($res = @mysql_query($query))) {
trigger_error(mysql_error(), E_USER_ERROR);
}
for ($i = 0; $i < mysql_num_rows($res); ++$i) {
$skins[] = mysql_result($res, $i, 0);
}
$now = gmdate('YmdHis');
$select = '`fk_user_id`,`status`,`del`,UNIX_TIMESTAMP(`last_changed`) as `last_changed`,UNIX_TIMESTAMP(`date_added`) as `date_added`,`_user`,`_photo`,`rad_longitude`,`rad_latitude`';
$used_fields = array();
foreach ($_pfields as $field_id => $field) {
if ($field->config['visible']) {
$select .= ',' . $field->query_select();
$used_fields[] = $field_id;
}
}
// create the cache in every skin
for ($s = 0; isset($skins[$s]); ++$s) {
$GLOBALS['_lang'] = array();
$GLOBALS['_pfields'] = array();
$GLOBALS['_pcats'] = array();
include _BASEPATH_ . '/skins_site/' . $skins[$s] . '/lang/global.inc.php';
include _BASEPATH_ . '/includes/fields.inc.php';
$query = "SELECT {$select} FROM `{$dbtable_prefix}user_profiles` WHERE `status`=" . STAT_APPROVED;
if (!empty($last_id)) {
$query .= " AND `fk_user_id`>{$last_id}";
}
$query .= " ORDER BY `fk_user_id`";
if (!($res = @mysql_query($query))) {
trigger_error(mysql_error(), E_USER_ERROR);
}
$start_time = (int) time();
while ($profile = mysql_fetch_assoc($res)) {
for ($i = 0; isset($used_fields[$i]); ++$i) {
$field =& $_pfields[$used_fields[$i]];
$field->set_value($profile, false);
$profile[$field->config['dbfield']] = $field->display();
// the label should be set after the call to display(). See field_birthdate::display() for explanation.
$profile[$field->config['dbfield'] . '_label'] = $field->config['label'];
}
if (empty($profile['_photo']) || !is_file(_PHOTOPATH_ . '/t1/' . $profile['_photo']) || !is_file(_PHOTOPATH_ . '/t2/' . $profile['_photo']) || !is_file(_PHOTOPATH_ . '/' . $profile['_photo'])) {
$profile['_photo'] = 'no_photo.gif';
} else {
$profile['has_photo'] = true;
}
$tpl->set_var('profile', $profile);
// generate the user details for result lists
$tpl->set_file('temp', $skins[$s] . '/static/result_user.html');
$towrite = $tpl->process('', 'temp', TPL_OPTIONAL);
$cache->save($towrite, 'skin' . $skins[$s] . $profile['fk_user_id'] . 'result_user');
// generate the categories to be used on profile.php page
$categs = array();
$tpl->set_file('temp', $skins[$s] . '/static/profile_categ.html');
foreach ($_pcats as $pcat_id => $pcat) {
$fields = array();
$j = 0;
for ($k = 0; isset($pcat['fields'][$k]); ++$k) {
if (in_array($pcat['fields'][$k], $used_fields) && !empty($profile[$_pfields[$pcat['fields'][$k]]->config['dbfield']])) {
$fields[$j]['label'] = $profile[$_pfields[$pcat['fields'][$k]]->config['dbfield'] . '_label'];
$fields[$j]['field'] = $profile[$_pfields[$pcat['fields'][$k]]->config['dbfield']];
$fields[$j]['dbfield'] = $_pfields[$pcat['fields'][$k]]->config['dbfield'];
++$j;
}
}
$categs['pcat_name'] = $pcat['pcat_name'];
$categs['pcat_id'] = $pcat_id;
$tpl->set_loop('fields', $fields);
$tpl->set_var('categs', $categs);
$towrite = $tpl->process('', 'temp', TPL_LOOP);
$cache->save($towrite, 'skin' . $skins[$s] . $profile['fk_user_id'] . 'pcat' . $pcat_id);
$tpl->drop_loop('fields');
$tpl->drop_var('categs');
}
$tpl->drop_var('profile');
if ((int) time() - $start_time > $timeout) {
echo 'To prevent timeouts this script interrupts every few minutes. Press the continue button to resume.<br />';
echo 'Last user ID processed: ', $profile['fk_user_id'], '<br />';
echo '<form action="regenerate_skin.php" method="get">';
echo '<input type="hidden" name="last_id" value="', $profile['fk_user_id'], '" />';
if (!empty($skin_module_code)) {
echo '<input type="hidden" name="s" value="', $skin_module_code, '" />';
}
echo '<input type="submit" value="Continue" />';
echo '</form>';
die;
}
}
}
}
示例13: gen_user_cache
function gen_user_cache()
{
global $dbtable_prefix, $_pfields, $_pcats;
$dirname = dirname(__FILE__);
$temp = array();
if ($dirname[0] == '/') {
// unixes here
$temp = explode('/', $dirname);
} else {
// windows here
$temp = explode('\\', $dirname);
}
$interval = (int) $temp[count($temp) - 1];
// that's how often we're executed ;)
$tpl = new phemplate(_BASEPATH_ . '/skins_site/', 'remove_nonjs');
$query = "SELECT a.`config_value` FROM `{$dbtable_prefix}site_options3` a,`{$dbtable_prefix}modules` b WHERE a.`config_option`='skin_dir' AND a.`fk_module_code`=b.`module_code` AND b.`module_type`=" . MODULE_SKIN;
if (!($res = @mysql_query($query))) {
trigger_error(mysql_error(), E_USER_ERROR);
}
$skins = array();
for ($i = 0; $i < mysql_num_rows($res); ++$i) {
$skins[] = mysql_result($res, $i, 0);
}
require _BASEPATH_ . '/includes/classes/Cache/Lite.php';
$cache = new Cache_Lite($GLOBALS['_cache_config']);
$now = gmdate('YmdHis');
$select = '`fk_user_id`,`status`,`del`,UNIX_TIMESTAMP(`last_changed`) as `last_changed`,UNIX_TIMESTAMP(`date_added`) as `date_added`,`_user`,`_photo`,`rad_longitude`,`rad_latitude`';
$used_fields = array();
foreach ($_pfields as $field_id => $field) {
if ($field->config['visible']) {
$select .= ',' . $field->query_select();
$used_fields[] = $field_id;
}
}
// create the cache in every skin
for ($s = 0; isset($skins[$s]); ++$s) {
$GLOBALS['_lang'] = array();
$GLOBALS['_pfields'] = array();
$GLOBALS['_pcats'] = array();
include _BASEPATH_ . '/skins_site/' . $skins[$s] . '/lang/global.inc.php';
include _BASEPATH_ . '/includes/fields.inc.php';
$query = "SELECT {$select} FROM `{$dbtable_prefix}user_profiles` WHERE `status`=" . STAT_APPROVED . " AND `last_changed`>=DATE_SUB('{$now}',INTERVAL " . ($interval + 2) . " MINUTE)";
//print $query;
if (!($res = @mysql_query($query))) {
trigger_error(mysql_error(), E_USER_ERROR);
}
while ($profile = mysql_fetch_assoc($res)) {
for ($i = 0; isset($used_fields[$i]); ++$i) {
$field =& $_pfields[$used_fields[$i]];
$field->set_value($profile, false);
$profile[$field->config['dbfield']] = $field->display();
// the label should be set after the call to display(). See field_birthdate::display() for explanation.
$profile[$field->config['dbfield'] . '_label'] = $field->config['label'];
/*
} elseif ($field['field_type']==FIELD_INT || $field['field_type']==FIELD_FLOAT) {
// $profile[$field['dbfield']]=$profile[$field['dbfield']];
*/
}
if (empty($profile['_photo']) || !is_file(_PHOTOPATH_ . '/t1/' . $profile['_photo']) || !is_file(_PHOTOPATH_ . '/t2/' . $profile['_photo']) || !is_file(_PHOTOPATH_ . '/' . $profile['_photo'])) {
$profile['_photo'] = 'no_photo.gif';
} else {
$profile['has_photo'] = true;
}
$tpl->set_var('profile', $profile);
// generate the user details for result lists
$tpl->set_file('temp', $skins[$s] . '/static/result_user.html');
$towrite = $tpl->process('', 'temp', TPL_OPTIONAL);
$cache->save($towrite, 'skin' . $skins[$s] . $profile['fk_user_id'] . 'result_user');
// generate the categories to be used on profile.php page
$categs = array();
$tpl->set_file('temp', $skins[$s] . '/static/profile_categ.html');
foreach ($_pcats as $pcat_id => $pcat) {
$fields = array();
$j = 0;
for ($k = 0; isset($pcat['fields'][$k]); ++$k) {
if (in_array($pcat['fields'][$k], $used_fields) && !empty($profile[$_pfields[$pcat['fields'][$k]]->config['dbfield']])) {
$fields[$j]['label'] = $profile[$_pfields[$pcat['fields'][$k]]->config['dbfield'] . '_label'];
$fields[$j]['field'] = $profile[$_pfields[$pcat['fields'][$k]]->config['dbfield']];
$fields[$j]['dbfield'] = $_pfields[$pcat['fields'][$k]]->config['dbfield'];
++$j;
}
}
$categs['pcat_name'] = $pcat['pcat_name'];
$categs['pcat_id'] = $pcat_id;
$tpl->set_loop('fields', $fields);
$tpl->set_var('categs', $categs);
$towrite = $tpl->process('', 'temp', TPL_LOOP);
$cache->save($towrite, 'skin' . $skins[$s] . $profile['fk_user_id'] . 'pcat' . $pcat_id);
$tpl->drop_loop('fields');
$tpl->drop_var('categs');
}
$tpl->drop_var('profile');
}
}
return true;
}
示例14: join
}
$output['ips'] = join(', ', $output['ips']);
}
$output['pic_width'] = get_site_option('pic_width', 'core_photo');
if (empty($output['search_md5'])) {
unset($output['search_md5']);
}
if (isset($_GET['o'])) {
$output['o'] = $_GET['o'];
}
if (isset($_GET['r'])) {
$output['r'] = $_GET['r'];
}
$output['return2me'] = 'profile.php';
if (!empty($_SERVER['QUERY_STRING'])) {
$output['return2me'] .= '?' . $_SERVER['QUERY_STRING'];
}
$output['return2me'] = rawurlencode($output['return2me']);
if (isset($_GET['return'])) {
$output['return2'] = sanitize_and_format($_GET['return'], TYPE_STRING, $__field2format[FIELD_TEXTFIELD]);
}
$tpl->set_file('content', 'profile.html');
$tpl->set_loop('categs', $categs);
$tpl->set_var('output', $output);
$tpl->set_var('account', $account);
$tpl->process('content', 'content', TPL_MULTILOOP | TPL_OPTIONAL);
$tpl->drop_loop('categs');
$tplvars['title'] = sprintf('%1$s Member Profile', $output['_user']);
$tplvars['css'] = 'profile.css';
$tplvars['page'] = 'profile';
include 'frame.php';
示例15: while
trigger_error(mysql_error(), E_USER_ERROR);
}
$i = 0;
while ($rsrow = mysql_fetch_assoc($res)) {
$rsrow['city'] = sanitize_and_format($rsrow['city'], TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
$rsrow['myclass'] = $i % 2 ? 'odd_item' : 'even_item';
$cities[] = $rsrow;
++$i;
}
$tpl->set_var('pager1', pager($totalrows, $o, $r));
$tpl->set_var('pager2', pager($totalrows, $o, $r));
}
}
$tpl->set_file('content', 'loc_cities.html');
$tpl->set_loop('cities', $cities);
$tpl->set_var('state_id', $state_id);
$tpl->set_var('state', $state);
$tpl->set_var('country_id', $country_id);
$tpl->set_var('country', $country);
$tpl->set_var('o', $o);
$tpl->set_var('r', $r);
$tpl->set_var('so', $so);
$tpl->set_var('sr', $sr);
$tpl->set_var('co', $co);
$tpl->set_var('cr', $cr);
$tpl->process('content', 'content', TPL_LOOP | TPL_NOLOOP);
$tpl->drop_loop('cities');
unset($cities);
$tplvars['title'] = 'Location Management: Cities';
$tplvars['page'] = 'loc_cities';
include 'frame.php';