'.$user['id'].' order by username '; $datas = pwg_query($query); if (!empty($datas)) { while ($admin = mysql_fetch_array($datas)) { if (!empty($admin['mail_address']) and (0!=strcasecmp($admin['mail_address'], $webmaster_email))) { array_push( $admins, format_email($admin['username'], $admin['mail_address']) ); } } } return $admins; } function cf_get_admins_contacts() { global $conf, $user; $admins = array(); $query = ' select U.'.$conf['user_fields']['username'].' as username, U.'.$conf['user_fields']['email'].' as mail_address from '.USERS_TABLE.' as U, '.USER_INFOS_TABLE.' as I where I.user_id = U.'.$conf['user_fields']['id'].' and I.status in (\'webmaster\', \'admin\') and I.adviser = \'false\' and '.$conf['user_fields']['email'].' is not null order by username '; $webmaster_mail = get_webmaster_mail_address(); $datas = pwg_query($query); if (!empty($datas)) { while ($admin = mysql_fetch_array($datas)) { if (!empty($admin['mail_address'])) { $name = $admin['username']; $webmaster = 0; if (0 == strcasecmp($webmaster_mail, $admin['mail_address'])) { $name = l10n('Webmaster'); $webmaster = 1; } $admins[$admin['mail_address']] = array( 'NAME' => $name, 'EMAILSTR' => format_email($name, $admin['mail_address']), 'ACTIVE' => 1, 'WEBMASTER'=> $webmaster, ); } } } return $admins; } /* Return template for user template/theme*/ function cf_get_template($file, $dir=CF_TEMPLATE, $prefix='') { global $user, $template; $theme_file = $dir. //$user[$prefix.'template'].'/'. $user['theme'].'/'. $file; $template_file = $dir. //$user[$prefix.'template'].'/'. $file; if (file_exists($theme_file)) { return $theme_file; } else { return $dir.$file; } } function contactForm_prefilter($content, &$smarty) { $search = '#{if\s+isset\s*\(\s*\$CONTACT_MAIL\s*\)\s*}.*?{/if}#s'; $replacement = '{if isset($ContactFormLink)}{$ContactFormLink}{/if}'; return preg_replace($search, $replacement, $content); } function cf_clean_obsolete_files($obsolete_file_list) { if (!file_exists(CF_PATH.$obsolete_file_list)) { return TRUE; } $obsolete = file(CF_PATH.$obsolete_file_list); array_push($obsolete, $obsolete_file_list); return cf_clean_obsolete_list($obsolete); } function cf_clean_obsolete_list($file_list = array(), &$errors = array()) { // Include language advices load_language('plugin.lang', CF_PATH); if (!function_exists('unlink')) { // No unlink available... array_push($errors, l10n('cf_no_unlink')); return FALSE; } $success = TRUE; foreach ($file_list as $file) { $file = CF_PATH . $file; if (file_exists($file)) { // Remove obsolete file $success &= unlink($file); } } if (!$success) { array_push($errors, l10n('cf_unlink_errors')); } return $success; } function cf_format_date($year, $month, $day, $format='%M %D, %Y') { $format = str_ireplace('%Y', $year, $format); $format = str_ireplace('%M', $month, $format); $format = str_ireplace('%D', $day, $format); return $format; } function cf_get_history_list($file_name, &$errors = array()) { // Include language advices load_language('plugin.lang', CF_PATH); global $lang; $month_list = $lang['month']; $history = array(); if (!file_exists($file_name)) { array_push($errors, sprintf(l10n('cf_file_not_found'), $file_name)); return $history; } $raw_history = file($file_name, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); $index = -1; array_push($errors, sprintf(l10n('cf_file_empty'), $file_name)); foreach($raw_history as $new_line) { $pos = strpos($new_line, ' '); switch ($pos) { case 0: // History item if (isset($history[$index]) and is_array($history[$index])) { array_push($history[$index]['CHANGES'], trim($new_line)); } break; default: // New history date $index++; list($date, $version) = explode(' ', $new_line); list($year, $month, $day) = explode('-', $date); $date_array = array('RAW' => $date); if (isset($month)) { $month = $month_list[intval($month)]; } if (isset($year) and isset($month) and isset($day)) { $date_array['FORMATTED'] = cf_format_date($year, $month, $day, l10n('cf_format_date')); } $history[$index] = array( 'DATE' => $date_array, 'VERSION' => $version, 'CHANGES' => array(), ); } } return $history; } ?>