/** * rcube_shared.inc: get_boolean() */ function test_get_boolean() { $input = array(false, 'false', '0', 'no', 'off', 'nein', 'FALSE', '', null); foreach ($input as $idx => $value) { $this->assertFalse(get_boolean($value), "Invalid result for {$idx} test item"); } $input = array(true, 'true', '1', 1, 'yes', 'anything', 1000); foreach ($input as $idx => $value) { $this->assertTrue(get_boolean($value), "Invalid result for {$idx} test item"); } }
/** * Decodes slideshow string params into array * * @param string $encode_params * @return array */ function decode_slideshow_params($encode_params = null) { global $conf; $result = get_default_slideshow_params(); if (is_numeric($encode_params)) { $result['period'] = $encode_params; } else { $matches = array(); if (preg_match_all('/([a-z]+)-(\\d+)/', $encode_params, $matches)) { $matchcount = count($matches[1]); for ($i = 0; $i < $matchcount; $i++) { $result[$matches[1][$i]] = $matches[2][$i]; } } if (preg_match_all('/([a-z]+)-(true|false)/', $encode_params, $matches)) { $matchcount = count($matches[1]); for ($i = 0; $i < $matchcount; $i++) { $result[$matches[1][$i]] = get_boolean($matches[2][$i]); } } } return correct_slideshow_params($result); }
* along with this program. If not, see <http://www.gnu.org/licenses/>. * ************************************************/ if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } // Check access and exit when user status is not ok check_status(ACCESS_ADMINISTRATOR); // Setup plugin Language load_language('plugin.lang', FORECAST_PATH); // Available options $available_add_before = array('Author' => l10n('Author'), 'datecreate' => l10n('Created on'), 'datepost' => l10n('Posted on'), 'Dimensions' => l10n('Dimensions'), 'File' => l10n('File'), 'Filesize' => l10n('Filesize'), 'Tags' => l10n('Tags'), 'Categories' => l10n('Albums'), 'Visits' => l10n('Visits'), 'Average' => l10n('Rating score'), 'rating' => l10n('Rate this photo'), 'Privacy' => l10n('Who can see this photo?')); // Available Units, https://developer.forecast.io/docs/v2 $available_units = array('us' => 'U.S. units', 'si' => 'International System of units', 'ca' => 'Canada units', 'uk2' => 'U.K. units', 'auto' => 'Automatic units'); // Available Languages, https://developer.forecast.io/docs/v2 $available_languages = array('ar' => 'Arabic', 'bs' => 'Bosnian', 'de' => 'German', 'en' => 'English', 'es' => 'Spanish', 'fr' => 'French', 'it' => 'Italian', 'nl' => 'Dutch', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ru' => 'Russian', 'sv' => 'Swedish', 'tet' => 'Tetum', 'tr' => 'Turkish', 'x-pig-latin' => 'Igpay Atinlay', 'zh' => 'Chinese'); // Update conf if submitted in admin site if (isset($_POST['forecast_config_submit'])) { $conf['forecast_conf'] = array('add_before' => $_POST['fc_add_before'], 'color_bkg' => $_POST['fc_color_bkg'], 'color_txt' => $_POST['fc_color_txt'], 'link' => $_POST['fc_link'], 'show' => get_boolean($_POST['fc_showlink']), 'api_key' => $_POST['fc_api_key'], 'unit' => $_POST['fc_unit'], 'lang' => $_POST['fc_lang']); // Update config to DB conf_update_param('forecast_conf', serialize($conf['forecast_conf'])); // the prefilter changes, we must delete compiled templates $template->delete_compiled_templates(); // Notify user all is fine array_push($page['infos'], l10n('Your configuration settings are saved')); } $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/admin.tpl'); // send value to template $template->assign('fc', $conf['forecast_conf']); $template->assign(array('AVAILABLE_ADD_BEFORE' => $available_add_before, 'AVAILABLE_UNITS' => $available_units, 'AVAILABLE_LANGUAGES' => $available_languages)); $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
// | group list | // +-----------------------------------------------------------------------+ $query = ' SELECT id, name, is_default FROM ' . GROUPS_TABLE . ' ORDER BY name ASC ;'; $result = pwg_query($query); $admin_url = get_root_url() . 'admin.php?page='; $perm_url = $admin_url . 'group_perm&group_id='; $del_url = $admin_url . 'group_list&delete='; $toggle_is_default_url = $admin_url . 'group_list&toggle_is_default='; while ($row = pwg_db_fetch_assoc($result)) { $query = ' SELECT u.' . $conf['user_fields']['username'] . ' AS username FROM ' . USERS_TABLE . ' AS u INNER JOIN ' . USER_GROUP_TABLE . ' AS ug ON u.' . $conf['user_fields']['id'] . ' = ug.user_id WHERE ug.group_id = ' . $row['id'] . ' ;'; $members = array(); $res = pwg_query($query); while ($us = pwg_db_fetch_assoc($res)) { $members[] = $us['username']; } $template->append('groups', array('NAME' => $row['name'], 'ID' => $row['id'], 'IS_DEFAULT' => get_boolean($row['is_default']) ? ' [' . l10n('default') . ']' : '', 'NB_MEMBERS' => count($members), 'L_MEMBERS' => implode(' <span class="userSeparator">·</span> ', $members), 'MEMBERS' => l10n_dec('%d member', '%d members', count($members)), 'U_DELETE' => $del_url . $row['id'] . '&pwg_token=' . get_pwg_token(), 'U_PERM' => $perm_url . $row['id'], 'U_ISDEFAULT' => $toggle_is_default_url . $row['id'] . '&pwg_token=' . get_pwg_token())); } // +-----------------------------------------------------------------------+ // | sending html code | // +-----------------------------------------------------------------------+ $template->assign_var_from_handle('ADMIN_CONTENT', 'group_list');
/** * Callback function for parsing an xml command tag * and turn it into real html content * * @param array Matches array of preg_replace_callback * @return string Tag/Object content */ protected function xml_command($matches) { $command = strtolower($matches[1]); $attrib = html::parse_attrib_string($matches[2]); // empty output if required condition is not met if (!empty($attrib['condition']) && !$this->check_condition($attrib['condition'])) { return ''; } // execute command switch ($command) { // return a button case 'button': if ($attrib['name'] || $attrib['command']) { return $this->button($attrib); } break; // show a label // show a label case 'label': if ($attrib['name'] || $attrib['command']) { $vars = $attrib + array('product' => $this->config->get('product_name')); unset($vars['name'], $vars['command']); $label = $this->app->gettext($attrib + array('vars' => $vars)); return !$attrib['noshow'] ? get_boolean((string) $attrib['html']) ? $label : html::quote($label) : ''; } break; // include a file // include a file case 'include': if (!$this->plugin_skin_path || !is_file($path = realpath($this->plugin_skin_path . $attrib['file']))) { $path = realpath(($attrib['skin_path'] ? $attrib['skin_path'] : $this->config->get('skin_path')) . $attrib['file']); } if (is_readable($path)) { if ($this->config->get('skin_include_php')) { $incl = $this->include_php($path); } else { $incl = file_get_contents($path); } $incl = $this->parse_conditions($incl); return $this->parse_xml($incl); } break; case 'plugin.include': $hook = $this->app->plugins->exec_hook("template_plugin_include", $attrib); return $hook['content']; break; // define a container block // define a container block case 'container': if ($attrib['name'] && $attrib['id']) { $this->command('gui_container', $attrib['name'], $attrib['id']); // let plugins insert some content here $hook = $this->app->plugins->exec_hook("template_container", $attrib); return $hook['content']; } break; // return code for a specific application object // return code for a specific application object case 'object': $object = strtolower($attrib['name']); $content = ''; // we are calling a class/method if (($handler = $this->object_handlers[$object]) && is_array($handler)) { if (is_object($handler[0]) && method_exists($handler[0], $handler[1]) || is_string($handler[0]) && class_exists($handler[0])) { $content = call_user_func($handler, $attrib); } } else { if (function_exists($handler)) { $content = call_user_func($handler, $attrib); } else { if ($object == 'doctype') { $content = html::doctype($attrib['value']); } else { if ($object == 'logo') { $attrib += array('alt' => $this->xml_command(array('', 'object', 'name="productname"'))); if ($logo = $this->config->get('skin_logo')) { $attrib['src'] = $logo; } $content = html::img($attrib); } else { if ($object == 'productname') { $name = $this->config->get('product_name', 'Roundcube Webmail'); $content = html::quote($name); } else { if ($object == 'version') { $ver = (string) RCMAIL_VERSION; if (is_file(INSTALL_PATH . '.svn/entries')) { if (preg_match('/Revision:\\s(\\d+)/', @shell_exec('svn info'), $regs)) { $ver .= ' [SVN r' . $regs[1] . ']'; } } else { if (is_file(INSTALL_PATH . '.git/index')) { if (preg_match('/Date:\\s+([^\\n]+)/', @shell_exec('git log -1'), $regs)) { if ($date = date('Ymd.Hi', strtotime($regs[1]))) { $ver .= ' [GIT ' . $date . ']'; } } } } $content = html::quote($ver); } else { if ($object == 'steptitle') { $content = html::quote($this->get_pagetitle()); } else { if ($object == 'pagetitle') { if ($this->config->get('devel_mode') && !empty($_SESSION['username'])) { $title = $_SESSION['username'] . ' :: '; } else { if ($prod_name = $this->config->get('product_name')) { $title = $prod_name . ' :: '; } else { $title = ''; } } $title .= $this->get_pagetitle(); $content = html::quote($title); } } } } } } } } // exec plugin hooks for this template object $hook = $this->app->plugins->exec_hook("template_object_{$object}", $attrib + array('content' => $content)); return $hook['content']; // return code for a specified eval expression // return code for a specified eval expression case 'exp': $value = $this->parse_expression($attrib['expression']); return eval("return html::quote({$value});"); // return variable // return variable case 'var': $var = explode(':', $attrib['name']); $name = $var[1]; $value = ''; switch ($var[0]) { case 'env': $value = $this->env[$name]; break; case 'config': $value = $this->config->get($name); if (is_array($value) && $value[$_SESSION['storage_host']]) { $value = $value[$_SESSION['storage_host']]; } break; case 'request': $value = rcube_utils::get_input_value($name, rcube_utils::INPUT_GPC); break; case 'session': $value = $_SESSION[$name]; break; case 'cookie': $value = htmlspecialchars($_COOKIE[$name]); break; case 'browser': $value = $this->browser->{$name}; break; } if (is_array($value)) { $value = implode(', ', $value); } return html::quote($value); break; } return ''; }
list($nb_geotagged) = pwg_db_fetch_array(pwg_query($query)); // Update conf if submitted in admin site if (isset($_POST['submit']) && !empty($_POST['osm_height'])) { // Check the center GPS position is valid $osm_left_center = (isset($_POST['osm_left_center']) and strlen($_POST['osm_left_center']) != 0) ? $_POST['osm_left_center'] : '0,0'; $center_arr = explode(',', $osm_left_center); //print_r($center_arr); $latitude = $center_arr[0]; $longitude = $center_arr[1]; if (isset($latitude) and isset($longitude)) { if (strlen($latitude) == 0 and strlen($longitude) == 0) { array_push($page['warnings'], l10n('Both latitude/longitude must not empty')); } } if (isset($latitude) and ($latitude <= -90 or $latitude >= 90)) { array_push($page['warnings'], l10n('The specify center latitude (-90=S to 90=N) is not valid')); } if (isset($longitude) and ($longitude <= -180 or $longitude >= 180)) { array_push($page['warnings'], l10n('The specify center longitude (-180=W to 180=E) is not valid')); } // On post admin form $conf['osm_conf'] = array('right_panel' => array('enabled' => get_boolean($_POST['osm_right_panel']), 'add_before' => $_POST['osm_add_before'], 'height' => $_POST['osm_height'], 'zoom' => $_POST['osm_zoom'], 'link' => $_POST['osm_right_link'], 'linkcss' => $_POST['osm_right_linkcss'], 'showosm' => get_boolean($_POST['osm_showosm'])), 'left_menu' => array('enabled' => get_boolean($_POST['osm_left_menu']), 'link' => $_POST['osm_left_link'], 'popup' => $_POST['osm_left_popup'], 'popupinfo_name' => isset($_POST['osm_left_popupinfo_name']), 'popupinfo_img' => isset($_POST['osm_left_popupinfo_img']), 'popupinfo_link' => isset($_POST['osm_left_popupinfo_link']), 'popupinfo_comment' => isset($_POST['osm_left_popupinfo_comment']), 'popupinfo_author' => isset($_POST['osm_left_popupinfo_author']), 'zoom' => $_POST['osm_left_zoom'], 'center' => $osm_left_center, 'autocenter' => get_boolean($_POST['osm_left_autocenter']), 'layout' => $_POST['osm_left_layout']), 'category_description' => array('enabled' => get_boolean($_POST['osm_category_description']), 'height' => $_POST['osm_cat_height'], 'width' => $_POST['osm_cat_width'], 'index' => $_POST['osm_cat_index']), 'main_menu' => array('enabled' => get_boolean($_POST['osm_main_menu']), 'height' => $_POST['osm_menu_height']), 'gpx' => array('height' => $_POST['osm_gpx_height'], 'width' => $_POST['osm_gpx_width']), 'batch' => array('global_height' => $_POST['osm_batch_global_height'], 'unit_height' => $_POST['osm_batch_unit_height']), 'map' => array('baselayer' => $_POST['osm_baselayer'], 'custombaselayer' => $_POST['osm_custombaselayer'], 'custombaselayerurl' => $_POST['osm_custombaselayerurl'], 'noworldwarp' => get_boolean($_POST['osm_noworldwarp']), 'attrleaflet' => get_boolean($_POST['osm_attrleaflet']), 'attrimagery' => get_boolean($_POST['osm_attrimagery']), 'attrplugin' => get_boolean($_POST['osm_attrplugin'])), 'pin' => array('pin' => $_POST['osm_pin'], 'pinpath' => $_POST['osm_pinpath'], 'pinsize' => $_POST['osm_pinsize'], 'pinshadowpath' => $_POST['osm_pinshadowpath'], 'pinshadowsize' => $_POST['osm_pinshadowsize'], 'pinoffset' => $_POST['osm_pinoffset'], 'pinpopupoffset' => $_POST['osm_pinpopupoffset'])); // Update config to DB conf_update_param('osm_conf', serialize($conf['osm_conf'])); // the prefilter changes, we must delete compiled templatess $template->delete_compiled_templates(); array_push($page['infos'], l10n('Your configuration settings are saved')); } // send value to template $template->assign($conf['osm_conf']); $template->assign(array('AVAILABLE_ADD_BEFORE' => $available_add_before, 'AVAILABLE_CAT_INDEX' => $available_cat_index, 'AVAILABLE_ZOOM' => $available_zoom, 'AVAILABLE_BASELAYER' => $available_baselayer, 'AVAILABLE_PIN' => $available_pin, 'AVAILABLE_POPUP' => $available_popup, 'AVAILABLE_LAYOUT' => $available_layout, 'NB_GEOTAGGED' => $nb_geotagged, 'OSM_PATH' => OSM_PATH, 'GLOBAL_MODE' => l10n('global mode'), 'SINGLE_MODE' => l10n('unit mode')));
/** * return true if mobile theme should be loaded * * @return bool */ function mobile_theme() { global $conf; if (empty($conf['mobile_theme'])) { return false; } if (isset($_GET['mobile'])) { $is_mobile_theme = get_boolean($_GET['mobile']); pwg_set_session_var('mobile_theme', $is_mobile_theme); } else { $is_mobile_theme = pwg_get_session_var('mobile_theme'); } if (is_null($is_mobile_theme)) { $is_mobile_theme = get_device() == 'mobile'; pwg_set_session_var('mobile_theme', $is_mobile_theme); } return $is_mobile_theme; }
function pfemail_check_accounts() { global $conf, $user; conf_update_param('pfemail_last_check', date('Y-m-d H:i:s')); require_once PFEMAIL_PATH . 'include/ImapMailbox.php'; $image_ids = array(); $query = ' SELECT * FROM ' . PFEMAIL_MAILBOXES_TABLE . ' ;'; $accounts = query2array($query); foreach ($accounts as $account) { $mailbox = new ImapMailbox($account['path'], $account['login'], $account['password'], $conf['upload_dir'] . '/buffer', 'utf-8'); $mails = array(); // Get some mail $mailsIds = $mailbox->searchMailBox('UNSEEN'); if (!$mailsIds) { continue; // check next email account } $mailId = reset($mailsIds); $mail = $mailbox->getMail($mailId); $attachments = $mail->getAttachments(); include_once PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php'; foreach ($attachments as $attachment) { $extension = strtolower(get_extension($attachment->{'name'})); if (!in_array($extension, $conf['picture_ext'])) { // the file has been downloaded, we have to remove it now unlink($attachment->{'filePath'}); continue; } $moderate = get_boolean($account['moderated']); $image_id = add_uploaded_file($attachment->{'filePath'}, stripslashes($attachment->{'name'}), array($account['category_id']), $moderate ? 16 : 0, null); // the photo is added by nobody (using the current user may make the // photo editable by her with Admin Tools...) single_update(IMAGES_TABLE, array('added_by' => null, 'name' => pfemail_clean_email_subject($mail->subject)), array('id' => $image_id)); $state = 'auto_validated'; if ($moderate) { $state = 'moderation_pending'; } list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); single_insert(PFEMAIL_PENDINGS_TABLE, array('image_id' => $image_id, 'state' => $state, 'added_on' => $dbnow, 'from_name' => $mail->fromName, 'from_address' => $mail->fromAddress, 'subject' => $mail->subject)); $image_ids[] = $image_id; } } if (count($image_ids) > 0) { include_once PHPWG_ROOT_PATH . 'admin/include/functions.php'; invalidate_user_cache(); // let's notify administrators $query = ' SELECT id FROM ' . GROUPS_TABLE . ' ;'; $group_ids = query2array($query, null, 'id'); if (count($group_ids) > 0) { include_once PHPWG_ROOT_PATH . 'include/functions_mail.inc.php'; $thumb_urls = array(); // force $conf['derivative_url_style'] to 2 (script) to make sure we // will use i.php?/upload and not _data/i/upload because you don't // know when the cache will be flushed $previous_derivative_url_style = $conf['derivative_url_style']; $conf['derivative_url_style'] = 2; $query = ' SELECT id, path FROM ' . IMAGES_TABLE . ' WHERE id IN (' . implode(',', $image_ids) . ') ;'; $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) { $thumb = DerivativeImage::thumb_url(array('id' => $row['id'], 'path' => $row['path'])); $thumb_urls[] = $thumb; } // restore configuration setting $conf['derivative_url_style'] = $previous_derivative_url_style; $thumbs_html_string = ''; foreach ($thumb_urls as $thumb_url) { if (!empty($thumbs_html_string)) { $thumbs_html_string .= ' '; } $thumbs_html_string .= '<img src="' . $thumb_url . '">'; } $content = $thumbs_html_string; // how many photos pending? $pendings = pfemail_get_pending_ids(); if (count($pendings) > 0) { $content .= '<br><br>'; $content .= '<a href="' . get_absolute_root_url() . 'admin.php?page=plugin-photo_from_email-pendings' . '">'; $content .= l10n('%d photos pending for validation', count($pendings)); $content .= '</a>'; } $real_user_id = $user['id']; $user['id'] = $conf['guest_id']; $subject = l10n('%d photos added by email', count($thumb_urls)); foreach ($group_ids as $group_id) { pwg_mail_group($group_id, array('subject' => '[' . $conf['gallery_title'] . '] ' . $subject, 'mail_title' => $conf['gallery_title'], 'mail_subtitle' => $subject, 'content' => $content, 'content_format' => 'text/html')); } } // restore current user $user['id'] = $real_user_id; } }
/** * Retrieves informations about a category. * * @param int $id * @return array */ function get_cat_info($id) { $query = ' SELECT * FROM ' . CATEGORIES_TABLE . ' WHERE id = ' . $id . ' ;'; $cat = pwg_db_fetch_assoc(pwg_query($query)); if (empty($cat)) { return null; } foreach ($cat as $k => $v) { // If the field is true or false, the variable is transformed into a // boolean value. if ($cat[$k] == 'true' or $cat[$k] == 'false') { $cat[$k] = get_boolean($cat[$k]); } } $upper_ids = explode(',', $cat['uppercats']); if (count($upper_ids) == 1) { // no need to make a query for level 1 $cat['upper_names'] = array(array('id' => $cat['id'], 'name' => $cat['name'], 'permalink' => $cat['permalink'])); } else { $query = ' SELECT id, name, permalink FROM ' . CATEGORIES_TABLE . ' WHERE id IN (' . $cat['uppercats'] . ') ;'; $names = query2array($query, 'id'); // category names must be in the same order than uppercats list $cat['upper_names'] = array(); foreach ($upper_ids as $cat_id) { $cat['upper_names'][] = $names[$cat_id]; } } return $cat; }
} single_update(CATEGORIES_TABLE, $data, array('id' => $data['id'])); if (isset($_POST['apply_commentable_on_sub'])) { $subcats = get_subcat_ids(array('id' => $data['id'])); $query = ' UPDATE ' . CATEGORIES_TABLE . ' SET commentable = \'' . $data['commentable'] . '\' WHERE id IN (' . implode(',', $subcats) . ') ;'; pwg_query($query); } // retrieve cat infos before continuing (following updates are expensive) $cat_info = get_cat_info($_GET['cat_id']); if ($_POST['visible'] == 'true_sub') { set_cat_visible(array($_GET['cat_id']), true, true); } elseif ($cat_info['visible'] != get_boolean($_POST['visible'])) { set_cat_visible(array($_GET['cat_id']), $_POST['visible']); } // in case the use moves his album to the gallery root, we force // $_POST['parent'] from 0 to null to be compared with // $cat_info['id_uppercat'] if (empty($_POST['parent'])) { $_POST['parent'] = null; } // only move virtual albums if (empty($cat_info['dir']) and $cat_info['id_uppercat'] != $_POST['parent']) { move_categories(array($_GET['cat_id']), $_POST['parent']); } $_SESSION['page_infos'][] = l10n('Album updated successfully'); $redirect = true; } elseif (isset($_POST['set_random_representant'])) {
public function compare_for_force($frecord) { $this->set_sf_fields($frecord); $record = new stdClass(); foreach ($this->mapping as $sql_field => $force_field) { switch ($sql_field) { case 'MURASPEC_YN': case 'BHS_YN': case 'GOODRICH_YN': case 'HITECH_YN': case 'NEWMORE_YN': case 'VESCOM_YN': case 'EDGE_YN': case 'DECORE_YN': case 'CASANA_YN': case 'SELTEX_YN': if (get_boolean($this->sql_fields[$sql_field]) != $this->force_fields[$force_field]) { $record->{$force_field} = get_boolean($this->sql_fields[$sql_field]); } break; default: if ($this->sql_fields[$sql_field] != $this->force_fields[$force_field]) { $record->{$force_field} = $this->sql_fields[$sql_field]; } break; } } return $record; }
public function compare_for_force($frecord) { $this->set_sf_fields($frecord); $record = new stdClass(); foreach ($this->mapping as $sql_field => $force_field) { switch ($sql_field) { case 'MOVED_YN': if (get_boolean($this->sql_fields[$sql_field]) != $this->force_fields[$force_field]) { $record->{$force_field} = get_yn($this->sql_fields[$sql_field]); } break; default: if ($this->sql_fields[$sql_field] != $this->force_fields[$force_field]) { $record->{$force_field} = $this->sql_fields[$sql_field]; } break; } } return $record; }
/** * Get themes defined in the theme directory */ function get_fs_themes() { $dir = opendir(PHPWG_THEMES_PATH); while ($file = readdir($dir)) { if ($file != '.' and $file != '..') { $path = PHPWG_THEMES_PATH . $file; if (is_dir($path) and preg_match('/^[a-zA-Z0-9-_]+$/', $file) and file_exists($path . '/themeconf.inc.php')) { $theme = array('id' => $file, 'name' => $file, 'version' => '0', 'uri' => '', 'description' => '', 'author' => '', 'mobile' => false); $theme_data = implode('', file($path . '/themeconf.inc.php')); if (preg_match("|Theme Name:\\s*(.+)|", $theme_data, $val)) { $theme['name'] = trim($val[1]); } if (preg_match("|Version:\\s*([\\w.-]+)|", $theme_data, $val)) { $theme['version'] = trim($val[1]); } if (preg_match("|Theme URI:\\s*(https?:\\/\\/.+)|", $theme_data, $val)) { $theme['uri'] = trim($val[1]); } if ($desc = load_language('description.txt', $path . '/', array('return' => true))) { $theme['description'] = trim($desc); } elseif (preg_match("|Description:\\s*(.+)|", $theme_data, $val)) { $theme['description'] = trim($val[1]); } if (preg_match("|Author:\\s*(.+)|", $theme_data, $val)) { $theme['author'] = trim($val[1]); } if (preg_match("|Author URI:\\s*(https?:\\/\\/.+)|", $theme_data, $val)) { $theme['author uri'] = trim($val[1]); } if (!empty($theme['uri']) and strpos($theme['uri'], 'extension_view.php?eid=')) { list(, $extension) = explode('extension_view.php?eid=', $theme['uri']); if (is_numeric($extension)) { $theme['extension'] = $extension; } } if (preg_match('/["\']parent["\'][^"\']+["\']([^"\']+)["\']/', $theme_data, $val)) { $theme['parent'] = $val[1]; } if (preg_match('/["\']activable["\'].*?(true|false)/i', $theme_data, $val)) { $theme['activable'] = get_boolean($val[1]); } if (preg_match('/["\']mobile["\'].*?(true|false)/i', $theme_data, $val)) { $theme['mobile'] = get_boolean($val[1]); } // screenshot $screenshot_path = $path . '/screenshot.png'; if (file_exists($screenshot_path)) { $theme['screenshot'] = $screenshot_path; } else { global $conf; $theme['screenshot'] = PHPWG_ROOT_PATH . 'admin/themes/' . $conf['admin_theme'] . '/images/missing_screenshot.png'; } $admin_file = $path . '/admin/admin.inc.php'; if (file_exists($admin_file)) { $theme['admin_uri'] = get_root_url() . 'admin.php?page=theme&theme=' . $file; } // IMPORTANT SECURITY ! $theme = array_map('htmlspecialchars', $theme); $this->fs_themes[$file] = $theme; } } } closedir($dir); }
$template->assign('REPOST_SUBMIT_NAME', $repost_submit_name); } switch ($page['mode']) { case 'param': $template->assign($page['mode'], array('SEND_HTML_MAIL' => $conf['nbm_send_html_mail'], 'SEND_MAIL_AS' => $conf['nbm_send_mail_as'], 'SEND_DETAILED_CONTENT' => $conf['nbm_send_detailed_content'], 'COMPLEMENTARY_MAIL_CONTENT' => $conf['nbm_complementary_mail_content'], 'SEND_RECENT_POST_DATES' => $conf['nbm_send_recent_post_dates'])); break; case 'subscribe': $template->assign($page['mode'], true); $template->assign(array('L_CAT_OPTIONS_TRUE' => l10n('Subscribed'), 'L_CAT_OPTIONS_FALSE' => l10n('Unsubscribed'))); $data_users = get_user_notifications('subscribe'); $opt_true = array(); $opt_true_selected = array(); $opt_false = array(); $opt_false_selected = array(); foreach ($data_users as $nbm_user) { if (get_boolean($nbm_user['enabled'])) { $opt_true[$nbm_user['check_key']] = stripslashes($nbm_user['username']) . '[' . $nbm_user['mail_address'] . ']'; if (isset($_POST['falsify']) and isset($_POST['cat_true']) and in_array($nbm_user['check_key'], $_POST['cat_true'])) { $opt_true_selected[] = $nbm_user['check_key']; } } else { $opt_false[$nbm_user['check_key']] = stripslashes($nbm_user['username']) . '[' . $nbm_user['mail_address'] . ']'; if (isset($_POST['trueify']) and isset($_POST['cat_false']) and in_array($nbm_user['check_key'], $_POST['cat_false'])) { $opt_false_selected[] = $nbm_user['check_key']; } } } $template->assign(array('category_option_true' => $opt_true, 'category_option_true_selected' => $opt_true_selected, 'category_option_false' => $opt_false, 'category_option_false_selected' => $opt_false_selected)); $template->assign_var_from_handle('DOUBLE_SELECT', 'double_select'); break; case 'send':
if ($handle = opendir(dirname(__FILE__) . '/../video-js/lang/')) { while (false !== ($entry = readdir($handle))) { if ($entry == '.' || $entry == '..') { continue; } array_push($available_languages, preg_replace('/.js/', '', $entry)); } closedir($handle); } // Available width value // http://en.wikipedia.org/wiki/Display_resolution $available_height = array('480' => 'EDTV: (720x480) ie: 480p', '576' => 'EDTV: (720×576) ie: 576p', '720' => 'HDReady: (1280x720) ie: 720p', '1080' => 'FullHD: (1920x1080) ie: 1080p', '2160' => '4k UHDTV: (3840×2160) ie: 2160p', '4320' => '8k UHDTV: (7680×4320) ie: 4320p'); // Update conf if submitted in admin site if (isset($_POST['submit']) && !empty($_POST['vjs_skin'])) { // keep the value in the admin form $conf['vjs_conf'] = array('skin' => $_POST['vjs_skin'], 'max_height' => $_POST['vjs_max_height'], 'preload' => $_POST['vjs_preload'], 'controls' => get_boolean($_POST['vjs_controls']), 'autoplay' => get_boolean($_POST['vjs_autoplay']), 'loop' => get_boolean($_POST['vjs_loop']), 'volume' => $_POST['vjs_volume'], 'language' => $_POST['vjs_language'], 'upscale' => get_boolean($_POST['vjs_upscale']), 'plugins' => array('zoomrotate' => get_boolean($_POST['vjs_zoomrotate']), 'thumbnails' => get_boolean($_POST['vjs_thumbnails']), 'watermark' => get_boolean($_POST['vjs_watermark']))); $customcss = $_POST['vjs_customcss']; // Update config to DB conf_update_param('vjs_conf', serialize($conf['vjs_conf'])); $query = "UPDATE " . CONFIG_TABLE . " SET value='" . $_POST['vjs_customcss'] . "' WHERE param='vjs_customcss'"; pwg_query($query); // the prefilter changes, we must delete compiled templatess $template->delete_compiled_templates(); array_push($page['infos'], l10n('Your configuration settings are saved')); } /* Get statistics */ // All videos with supported extensions by VideoJS $query = "SELECT COUNT(*) FROM " . IMAGES_TABLE . " WHERE " . SQL_VIDEOS . ";"; list($nb_videos) = pwg_db_fetch_row(pwg_query($query)); // All videos with supported extensions by VideoJS and thumb $query = "SELECT COUNT(*) FROM " . IMAGES_TABLE . " WHERE `representative_ext` IS NOT NULL AND " . SQL_VIDEOS . ";";