/** * plugin initialization */ function oauth_init() { global $conf, $page, $hybridauth_conf, $template; load_language('plugin.lang', OAUTH_PATH); $conf['oauth'] = safe_unserialize($conf['oauth']); // check config if (defined('IN_ADMIN')) { if (empty($hybridauth_conf) and strpos(@$_GET['page'], 'plugin-oAuth') === false) { $page['warnings'][] = '<a href="' . OAUTH_ADMIN . '">' . l10n('Social Connect: You need to configure the credentials') . '</a>'; } if (!function_exists('curl_init')) { $page['warnings'][] = l10n('Social Connect: PHP Curl extension is needed'); } } // in case of registration aborded if (script_basename() == 'index' and ($oauth_id = pwg_get_session_var('oauth_new_user')) !== null) { pwg_unset_session_var('oauth_new_user'); if ($oauth_id[0] == 'Persona') { oauth_assign_template_vars(get_gallery_home_url()); $template->block_footer_script(null, 'navigator.id.logout();'); } else { require_once OAUTH_PATH . 'include/hybridauth/Hybrid/Auth.php'; try { $hybridauth = new Hybrid_Auth($hybridauth_conf); $adapter = $hybridauth->getAdapter($oauth_id[0]); $adapter->logout(); } catch (Exception $e) { } } } }
function osm_loc_end_element_set_global() { global $template, $conf; $batch_global_height = isset($conf['osm_conf']['batch']['global_height']) ? $conf['osm_conf']['batch']['global_height'] : '200'; $template->append('element_set_global_plugins_actions', array('ID' => 'openstreetmap', 'NAME' => l10n('OSM GeoTag'), 'CONTENT' => ' <label>' . l10n('Latitude') . ' (-90=S to 90=N) <input type="text" size="8" name="osmlat"> </label> <label>' . l10n('Longitude') . ' (-180=W to 180=E) <input type="text" size="9" name="osmlon"> </label> (Empty values will erase coordinates) <style type="text/css"> .map1 { height: ' . $batch_global_height . 'px !important; width:100% !important; margin: 5px; } </style> <script src="plugins/piwigo-openstreetmap/leaflet/qleaflet.jquery.js"></script> <div class="osm-map1 map1"></div> <script> $(document).ready(function() { $("#permitAction").on("change", function (e) { var optionSelected = $("option:selected", this); if ("openstreetmap" == optionSelected.val()) { $(".osm-map1").qleaflet(); } }); }); </script> ')); }
function multimedia_publish_attachments_register(&$attachment_types) { l10n_load('plugins/multimedia/l10n'); $attachment_types[] = array('caption' => l10n('mm.attach.pic'), 'editor' => 'multimedia/picture.php'); $attachment_types[] = array('caption' => l10n('mm.attach.link'), 'editor' => 'multimedia/link.php'); $attachment_types[] = array('caption' => l10n('mm.attach.text'), 'editor' => 'multimedia/text.php'); }
static function on_index_thumbnails($thumbs) { global $page, $template; $total = count($page['items']); if (count($thumbs) >= $total) { add_event_handler('loc_end_index', array('RVTS', 'on_end_index')); return $thumbs; } $url_model = str_replace('123456789', '%start%', duplicate_index_url(array('start' => 123456789))); $ajax_url_model = add_url_params($url_model, array('rvts' => '%per%')); $url_model = str_replace('&', '&', $url_model); $ajax_url_model = str_replace('&', '&', $ajax_url_model); $my_base_name = basename(dirname(__FILE__)); $ajax_loader_image = get_root_url() . "plugins/{$my_base_name}/ajax-loader.gif"; $template->func_combine_script(array('id' => 'jquery', 'load' => 'footer', 'path' => 'themes/default/js/jquery.min.js')); $template->func_combine_script(array('id' => $my_base_name, 'load' => 'async', 'path' => 'plugins/' . $my_base_name . '/rv_tscroller.min.js', 'require' => 'jquery', 'version' => RVTS_VERSION)); $start = (int) $page['start']; $per_page = $page['nb_image_page']; $moreMsg = 'See the remaining %d photos'; if ('en' != $GLOBALS['lang_info']['code']) { load_language('lang', dirname(__FILE__) . '/'); $moreMsg = l10n($moreMsg); } // the String.fromCharCode comes from google bot which somehow manage to get these urls $template->block_footer_script(null, "var RVTS = {\najaxUrlModel: String.fromCharCode(" . ord($ajax_url_model[0]) . ")+'" . substr($ajax_url_model, 1) . "',\nstart: {$start},\nperPage: {$per_page},\nnext: " . ($start + $per_page) . ",\ntotal: {$total},\nurlModel: String.fromCharCode(" . ord($url_model[0]) . ")+'" . substr($url_model, 1) . "',\nmoreMsg: '{$moreMsg}',\nprevMsg: '" . l10n("Previous") . "',\najaxLoaderImage: '{$ajax_loader_image}'\n};\njQuery('.navigationBar').hide();"); return $thumbs; }
private function setPluginWarnings() { global $pwg_loaded_plugins, $page; if (isset($pwg_loaded_plugins['language_switch'])) { $page['errors'][] = l10n('Language Switch plugin is enabled but is not compatible with the Bootstrap Default theme. Please disable it and download the <a href="http://piwigo.org/ext/extension_view.php?eid=797" target="_new">Bootstrap Default Language Switch</a> instead.'); } }
function friends_list_rowcallback($ds) { $rowid = 'row_'.$ds['_key']; ?><div id="<?= $rowid ?>"> <input type="button" value="<?= l10n('remove') ?>" onclick="friend_remove('<?= $rowid ?>', <?= $ds['_key'] ?>);"/> <span id="<?= $rowid ?>_status"></span> </div><? }
function cdnplus_admin_menu($menu) { global $page, $conf; if (!empty($conf['cdnplus_conf']['cdn_enabled']) && empty($conf['cdnplus_conf']['cdn_1']['host']) and in_array($page['page'], array('intro', 'plugins_list'))) { $page['errors'][] = l10n('You need to set your CDN host'); } $admin_url = get_admin_plugin_menu_link(dirname(__FILE__) . '/admin.php'); array_push($menu, array('NAME' => 'CDNPlus', 'URL' => get_admin_plugin_menu_link(dirname(__FILE__)) . '/admin.php')); return $menu; }
function index() { $this->form = new CQForm('settings'); $this->form->ds =& $this->user->settings; $this->form->add('html', l10n('email.notify'))->add('checkbox', 'email_friendrequest')->add('checkbox', 'email_wallpost')->add('checkbox', 'email_comment')->add('checkbox', 'email_response')->add('checkbox', 'email_message')->add('html', '<br/>')->add('submit', 'save'); if ($this->form->submitted) { $this->form->getData(); #$this->user->ds['u_email'] = getDefault($this->user->ds['u_email'], $this->form->ds['email']); $this->user->save(); } }
function content_55bbb4a38f51d5_13758895($_smarty_tpl) { if (empty($_smarty_tpl->tpl_vars['load_mode']->value)) { $_smarty_tpl->tpl_vars['load_mode'] = new Smarty_variable('footer', null, 0); } echo $_smarty_tpl->getSubTemplate('include/colorbox.inc.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array('load_mode' => $_smarty_tpl->tpl_vars['load_mode']->value), 0); ?> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['combine_script'][0][0]->func_combine_script(array('id' => 'jquery.selectize', 'load' => 'footer', 'path' => 'themes/default/js/plugins/selectize.min.js'), $_smarty_tpl); ?> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['combine_css'][0][0]->func_combine_css(array('id' => 'jquery.selectize', 'path' => "themes/default/js/plugins/selectize." . (string) $_smarty_tpl->tpl_vars['themeconf']->value['colorscheme'] . ".css"), $_smarty_tpl); ?> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['combine_script'][0][0]->func_combine_script(array('id' => 'addAlbum', 'load' => $_smarty_tpl->tpl_vars['load_mode']->value, 'path' => 'admin/themes/default/js/addAlbum.js'), $_smarty_tpl); ?> <div style="display:none"> <div id="addAlbumForm"> <form> <?php echo l10n('Parent album'); ?> <br> <select name="category_parent"></select> <br><br> <?php echo l10n('Album name'); ?> <br> <input name="category_name" type="text" maxlength="255"> <span id="categoryNameError" style="color:red;"><?php echo l10n('The name of an album must not be empty'); ?> </span> <br><br><br> <input type="submit" value="<?php echo l10n('Create'); ?> "> <span id="albumCreationLoading" style="display:none"><img src="themes/default/images/ajax-loader-small.gif"></span> </form> </div> </div> <?php }
static function getMenuLinks() { $items = array(); $items[] = array('icon' => 'building-o', 'title' => l10n('devices.index'), 'url' => actionUrl('index', 'devices')); $items[] = array('icon' => 'hand-o-down', 'title' => l10n('events.manual'), 'url' => actionUrl('manual', 'events')); $items[] = array('icon' => 'heartbeat', 'title' => l10n('radiator.minion'), 'url' => actionUrl('index', 'radiator')); if (cfg('cameras')) { $items[] = array('icon' => 'video-camera', 'title' => l10n('cam.index'), 'url' => actionUrl('index', 'cam')); } return $items; }
function gb_section_init() { global $tokens, $page, $conf; if ($tokens[0] == 'guestbook') { $page['section'] = 'guestbook'; $page['body_id'] = 'theGuestBook'; $page['is_external'] = true; $page['is_homepage'] = false; $page['title'] = l10n('GuestBook'); $page['section_title'] = '<a href="' . get_gallery_home_url() . '">' . l10n('Home') . '</a>' . $conf['level_separator'] . l10n('GuestBook'); } }
function vjs_loc_end_element_set_global() { global $template; $template->append('element_set_global_plugins_actions', array('ID' => 'videojs', 'NAME' => l10n('Videos'), 'CONTENT' => ' <legend>Synchronize metadata</legend> <ul> <li> <label><input type="checkbox" name="vjs_metadata" value="1" checked="checked" /> filesize, width, height, latitude, longitude, date_creation, rotation</label> <br/><small>Will overwrite the information in the database with the metadata from the video.</small> <br/><small><strong>Require <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">\'MediaInfo\'</a> to be install.</strong></small> </li> </ul> <legend>Poster</legend> <ul> <li> <label><input type="checkbox" name="vjs_poster" value="1" checked="checked" /> Create a poster at position in second:</label> <!-- <input type="range" name="vjs_postersec" value="4" min="0" max="60" step="1"/> --> <input type="text" name="vjs_postersec" value="4" size="2" required/> <br/><small>Create a poster from the video at specify position.</small> <br/><small><strong>Require <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">\'FFmpeg\'</a> to be install.</strong></small> </li> <li> <label><input type="checkbox" name="vjs_posteroverwrite" value="1" checked="checked"> Overwrite existing posters</label> <br/><small>Overwrite existing thumbnails with new ones. If uncheck it should only run for newly added video.</small> </li> <li> <label><span class="property">Output format : </span></label> <label><input type="radio" name="vjs_output" value="jpg" checked="checked"/> JPG</label> <label><input type="radio" name="vjs_output" value="png" /> PNG</label> <br/><small>Select the output format for the poster and thumbnail.</small> </li> <li> <label><input type="checkbox" name="vjs_posteroverlay" value="1" /> Add film effect</label> <br/><small>Apply an overlay on the poster creation.</small> </li> </ul> <legend>Thumbnail</legend> <ul> <li> <label><input type="checkbox" name="vjs_thumb" value="1" /> Create a thumbnail at every seconds:</label> <!-- <input type="range" name="vjs_thumbsec" value="5" min="0" max="60" step="1"/> --> <input type="text" name="vjs_thumbsec" value="5" size="2" required/> <br/><small>Create a thumbnail every x seconds. <strong>Use by the videoJS plugin thumbnail</strong>.</small> </li> <li> <label>Size of the thumbnail:</label> <input type="text" name="vjs_thumbsize" value="120x68" size="5" placeholder="120x68" required/> <br/><small>Size in pixel, keep it small, default is fine, Youtube use 190x68.</small> </li> </ul> ')); }
function friends_rcv_rowcallback($ds) { $rowid = 'row_'.$ds['_key']; ?><div id="<?= $rowid ?>"> <input type="button" value="<?= l10n('ignore') ?>" onclick="friend_ignore('<?= $rowid ?>', <?= $ds['_key'] ?>);"/> <input type="button" value="<?= l10n('accept') ?>" onclick="friend_accept('<?= $rowid ?>', <?= $ds['_key'] ?>);"/> <span class="smalltext">into</span> <select id="group_select_<?= $rowid ?>"> <?= implode('', $GLOBALS['group.options']) ?> </select> <span id="<?= $rowid ?>_status"></span> </div><? }
/** * Check comment rules set in plugin before accepting it * * @param : comment action, comment * * @return : comment action * */ function CM_CheckComment($comment_action, $comm) { global $page, $conf, $user, $template; load_language('plugin.lang', CM_PATH); $conf_CM = unserialize($conf['CommentsManager']); if ($conf['comments_forall']) { // Does not allow empty author name on comments for all if (isset($conf_CM['CM_No_Comment_Anonymous']) and $conf_CM['CM_No_Comment_Anonymous'] == 'true' and $comm['author'] == 'guest') { $comment_action = 'reject'; array_push($page['errors'], l10n('CM_Not_Allowed_Author')); } if (isset($conf_CM['CM_GROUPVALID2']) and $conf_CM['CM_GROUPVALID2'] == 'true' and !is_a_guest() and $conf['comments_validation']) { if (CM_CheckValidGroup($comm['author']) or is_admin()) { $comment_action = 'validate'; // Comment is validated if author is not in the validated group } else { $comment_action = 'moderate'; // Comment needs moderation if author is not in the validated group } } } // Rules on comments NOT for all if (!$conf['comments_forall'] and !is_admin()) { if (isset($conf_CM['CM_GROUPCOMM']) and $conf_CM['CM_GROUPCOMM'] == 'true' and (isset($conf_CM['CM_GROUPVALID1']) and $conf_CM['CM_GROUPVALID1'] == 'false') and !CM_CheckAuthor($comm['author'])) { $comment_action = 'reject'; // Comment rejected if author is not in the allowed group array_push($page['errors'], l10n('CM_Not_Allowed_Author')); } elseif (isset($conf_CM['CM_GROUPCOMM']) and $conf_CM['CM_GROUPCOMM'] == 'false' and (isset($conf_CM['CM_GROUPVALID1']) and $conf_CM['CM_GROUPVALID1'] == 'true') and $conf['comments_validation']) { if (CM_CheckValidGroup($comm['author']) and $conf['comments_validation']) { $comment_action = 'validate'; // Comment is validated if author is not in the validated group } else { $comment_action = 'moderate'; // Comment needs moderation if author is not in the validated group } } elseif (isset($conf_CM['CM_GROUPCOMM']) and $conf_CM['CM_GROUPCOMM'] == 'true' and (isset($conf_CM['CM_GROUPVALID1']) and $conf_CM['CM_GROUPVALID1'] == 'true') and $conf['comments_validation']) { if (!CM_CheckAuthor($comm['author'])) { $comment_action = 'reject'; // Comment rejected if author is not in the allowed group array_push($page['errors'], l10n('CM_Not_Allowed_Author')); } elseif (CM_CheckValidGroup($comm['author']) and $conf['comments_validation']) { $comment_action = 'validate'; // Comment is validated if author is not in the validated group } else { $comment_action = 'moderate'; } // Comment needs moderation if author is not in the validated group } } return $comment_action; }
function osm_render_category() { global $template, $page, $conf, $filter; include_once dirname(__FILE__) . '/include/functions.php'; include_once dirname(__FILE__) . '/include/functions_map.php'; osm_load_language(); load_language('plugin.lang', OSM_PATH); // TF, 20160102: pass config as parameter $js_data = osm_get_items($conf, $page); if ($js_data != array()) { $local_conf = array(); $local_conf['contextmenu'] = 'false'; $local_conf['control'] = true; $local_conf['img_popup'] = false; $local_conf['popup'] = 1; $local_conf['center_lat'] = 0; $local_conf['center_lng'] = 0; $local_conf['zoom'] = 2; $local_conf['auto_center'] = 1; // TF, 20160102: pass config as parameter $local_conf['paths'] = osm_get_gps($conf, $page); $height = isset($conf['osm_conf']['category_description']['height']) ? $conf['osm_conf']['category_description']['height'] : '200'; $width = isset($conf['osm_conf']['category_description']['width']) ? $conf['osm_conf']['category_description']['width'] : 'auto'; $js = osm_get_js($conf, $local_conf, $js_data); $template->set_filename('map', dirname(__FILE__) . '/template/osm-category.tpl'); $template->assign(array('CONTENT_ENCODING' => get_pwg_charset(), 'OSM_PATH' => embellish_url(get_gallery_home_url() . OSM_PATH), 'HOME' => make_index_url(), 'HOME_PREV' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : get_absolute_root_url(), 'HOME_NAME' => l10n("Home"), 'HOME_PREV_NAME' => l10n("Previous"), 'OSMJS' => $js, 'HEIGHT' => $height, 'WIDTH' => $width)); $osm_content = $template->parse('map', true); //$osm_content = '<div id="osmmap"><div class="map_title">'.l10n('EDIT_MAP').'</div>' . $osm_content . '</div>'; $index = isset($conf['osm_conf']['category_description']['index']) ? $conf['osm_conf']['category_description']['index'] : 0; // 0 - PLUGIN_INDEX_CONTENT_BEGIN // 1 - PLUGIN_INDEX_CONTENT_COMMENT // 2 - PLUGIN_INDEX_CONTENT_END if ($index <= 1) { // From index category comment at L300 if ($page['start'] == 0 and !isset($page['chronology_field'])) { if (empty($page['comment'])) { $page['comment'] = $osm_content; } else { if ($index == 0) { $page['comment'] = '<div>' . $osm_content . $page['comment'] . '</div>'; } else { $page['comment'] = '<div>' . $page['comment'] . $osm_content . '</div>'; } } } } else { $osm_content = '<div id="osmmap">' . $osm_content . '</div>'; $template->concat('PLUGIN_INDEX_CONTENT_END', "\n" . $osm_content); } } }
function plugin_install() { global $prefixeTable; if (!defined('OSM_PATH')) { define('OSM_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); } // Remove unused files from previous version $toremove = array("admin.tpl", "admin.php", "admin_boot.php", "leaflet/leaflet.ie.css", "leaflet/MarkerCluster.Default.ie.css", "admin/admin_sync.php", "admin/admin_sync.tpl", "admin/admin_gps.php", "admin/admin_gps.tpl"); foreach ($toremove as $file) { if (is_file(OSM_PATH . $file)) { @unlink(OSM_PATH . $file); } } $default_config = array('right_panel' => array('enabled' => true, 'add_before' => 'Average', 'height' => '200', 'zoom' => 12, 'link' => 'Location', 'linkcss' => null, 'showosm' => true), 'left_menu' => array('enabled' => true, 'link' => l10n('OSWORLDMAP'), 'popup' => 0, 'popupinfo_name' => true, 'popupinfo_img' => true, 'popupinfo_link' => true, 'popupinfo_comment' => true, 'popupinfo_author' => true, 'zoom' => 2, 'center' => '0,0', 'layout' => 2), 'category_description' => array('enabled' => true, 'index' => 0, 'height' => '200', 'width' => 'auto'), 'main_menu' => array('enabled' => false, 'height' => '200'), 'gpx' => array('height' => '500', 'width' => '320'), 'batch' => array('global_height' => '200', 'unit_height' => '200'), 'map' => array('baselayer' => 'mapnik', 'custombaselayer' => null, 'custombaselayerurl' => null, 'noworldwarp' => false, 'attrleaflet' => true, 'attrimagery' => true, 'attrplugin' => true), 'pin' => array('pin' => 1, 'pinpath' => '', 'pinsize' => '', 'pinshadowpath' => '', 'pinshadowsize' => '', 'pinoffset' => '', 'pinpopupoffset' => '')); /* Add configuration to the config table */ $conf['osm_conf'] = serialize($default_config); conf_update_param('osm_conf', $conf['osm_conf']); $q = 'UPDATE ' . CONFIG_TABLE . ' SET `comment` = "Configuration settings for piwigo-openstreetmap plugin" WHERE `param` = "osm_conf";'; pwg_query($q); // Remove previous created db table for GPX entries $q = "DROP TABLE IF EXISTS " . $prefixeTable . "osm_gps;"; pwg_query($q); // Remove previous created directory for GPX entries $gpx_dir = PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'gps_track_files/'; if (file_exists($gpx_dir) and is_dir($gpx_dir)) { osm_deltree($gpx_dir); } // Create world map link $dir_name = basename(dirname(__FILE__)); $c = <<<EOF <?php define('PHPWG_ROOT_PATH','./'); if (isset(\$_GET['v']) and \$_GET['v'] == 1) \tinclude_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap.php'); else if (isset(\$_GET['v']) and \$_GET['v'] == 2) \tinclude_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap2.php'); else if (isset(\$_GET['v']) and \$_GET['v'] == 3) \tinclude_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap3.php'); else if (isset(\$_GET['v']) and \$_GET['v'] == 4) \tinclude_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap4.php'); else \tinclude_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap3.php'); ?> EOF; $fp = fopen(PHPWG_ROOT_PATH . 'osmmap.php', 'w'); fwrite($fp, $c); fclose($fp); }
function get_choosen_sort_orders($orders) { global $conf, $page; array_push($orders, array(l10n('Random'), 'RAND()', true)); $to_remove = array(); foreach ($conf['sortorders']['disabled'] as $disabled) { foreach ($orders as $order) { if (str_replace(' ', '_', $order[1]) == $disabled) { array_push($to_remove, $order[1]); } } } return array_filter($orders, function ($v) use($to_remove) { return !in_array($v[1], $to_remove); }); }
function NBMS_Load_Profile() { global $conf, $user, $template, $lang; $query = ' SELECT enabled FROM ' . USER_MAIL_NOTIFICATION_TABLE . ' WHERE user_id = \'' . $user['id'] . '\' ;'; $data = pwg_db_fetch_assoc(pwg_query($query)); $values = $data['enabled']; if (is_null($values)) { $values = 'false'; } $template->assign('radio_options', array('true' => l10n('Yes'), 'false' => l10n('No'))); $template->assign(array('NBMS' => $values)); $template->set_prefilter('profile_content', 'NBMS_prefilter'); }
/** * Initialize the calendar * @param string $inner_sql */ function initialize($inner_sql) { parent::initialize($inner_sql); global $lang, $conf; $week_no_labels = array(); for ($i = 1; $i <= 53; $i++) { $week_no_labels[$i] = l10n('Week %d', $i); //$week_no_labels[$i] = $i; } $this->calendar_levels = array(array('sql' => pwg_db_get_year($this->date_field), 'labels' => null), array('sql' => pwg_db_get_week($this->date_field) . '+1', 'labels' => $week_no_labels), array('sql' => pwg_db_get_dayofweek($this->date_field) . '-1', 'labels' => $lang['day'])); //Comment next lines for week starting on Sunday or if MySQL version<4.0.17 //WEEK(date,5) = "0-53 - Week 1=the first week with a Monday in this year" if ('monday' == $conf['week_starts_on']) { $this->calendar_levels[CWEEK]['sql'] = pwg_db_get_week($this->date_field, 5) . '+1'; $this->calendar_levels[CDAY]['sql'] = pwg_db_get_weekday($this->date_field); $this->calendar_levels[CDAY]['labels'][] = array_shift($this->calendar_levels[CDAY]['labels']); } }
function content_55bbb46576e718_08061042($_smarty_tpl) { ?> <dt><?php echo l10n('Specials'); ?> </dt> <dd> <ul> <?php $_smarty_tpl->tpl_vars['link'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['link']->_loop = false; $_from = $_smarty_tpl->tpl_vars['block']->value->data; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['link']->key => $_smarty_tpl->tpl_vars['link']->value) { $_smarty_tpl->tpl_vars['link']->_loop = true; ?> <li><a href="<?php echo $_smarty_tpl->tpl_vars['link']->value['URL']; ?> " title="<?php echo $_smarty_tpl->tpl_vars['link']->value['TITLE']; ?> "<?php if (isset($_smarty_tpl->tpl_vars['link']->value['REL'])) { ?> <?php echo $_smarty_tpl->tpl_vars['link']->value['REL']; } ?> ><?php echo $_smarty_tpl->tpl_vars['link']->value['NAME']; ?> </a></li> <?php } ?> </ul> </dd> <?php }
function getMyGroups() { l10n_load('mvc/friends/l10n'); $result = array(); $grpList = DB_GetList('SELECT * FROM '.getTableName('localgroups').' WHERE lg_entity = ?', array(object('user')->ds['u_entity'])); if(sizeof($grpList) == 0) { foreach(explode(',', '_friends,_colleagues,_acquaintances,_family') as $gname) { $nds = array('lg_entity' => object('user')->ds['u_entity'], 'lg_name' => $gname); $nds['lg_key'] = DB_UpdateDataset('localgroups', $nds); $grpList[] = $nds; } } foreach($grpList as $grp) { if(substr($grp['lg_name'], 0, 1) == '_') $grp['lg_name'] = l10n($grp['lg_name']); $result[] = $grp; } return($result); }
function parse_sort_variables($sortable_by, $default_field, $get_param, $get_rejects, $template_var, $anchor = '') { global $template; $url_components = parse_url($_SERVER['REQUEST_URI']); $base_url = $url_components['path']; parse_str($url_components['query'], $vars); $is_first = true; foreach ($vars as $key => $value) { if (!in_array($key, $get_rejects) and $key != $get_param) { $base_url .= $is_first ? '?' : '&'; $is_first = false; $base_url .= $key . '=' . urlencode($value); } } $ret = array(); foreach ($sortable_by as $field) { $url = $base_url; $disp = '↓'; // TODO: an small image is better if ($field !== @$_GET[$get_param]) { if (!isset($default_field) or $default_field != $field) { // the first should be the default $url = add_url_params($url, array($get_param => $field)); } elseif (isset($default_field) and !isset($_GET[$get_param])) { $ret[] = $field; $disp = '<em>' . $disp . '</em>'; } } else { $ret[] = $field; $disp = '<em>' . $disp . '</em>'; } if (isset($template_var)) { $template->assign($template_var . strtoupper($field), '<a href="' . $url . $anchor . '" title="' . l10n('Sort order') . '">' . $disp . '</a>'); } } return $ret; }
SELECT id, name, id_uppercat FROM ' . CATEGORIES_TABLE . ' WHERE id IN (' . implode(',', $category_ids) . ') ;'; $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) { if ($order_by_date) { $sort[] = $ref_dates[$row['id']]; } else { $sort[] = remove_accents($row['name']); } $categories[] = array('id' => $row['id'], 'id_uppercat' => $row['id_uppercat']); } array_multisort($sort, SORT_REGULAR, 'ASC' == $order_by_asc ? SORT_ASC : SORT_DESC, $categories); save_categories_order($categories); $page['infos'][] = l10n('Albums automatically sorted'); } // +-----------------------------------------------------------------------+ // | Navigation path | // +-----------------------------------------------------------------------+ if (isset($_GET['parent_id'])) { $navigation .= $conf['level_separator']; $navigation .= get_cat_display_name_from_id($_GET['parent_id'], $base_url . '&parent_id='); } // +-----------------------------------------------------------------------+ // | template initialization | // +-----------------------------------------------------------------------+ $template->set_filename('categories', 'cat_list.tpl'); $form_action = PHPWG_ROOT_PATH . 'admin.php?page=cat_list'; if (isset($_GET['parent_id'])) { $form_action .= '&parent_id=' . $_GET['parent_id'];
<?php // Need upgrade? global $conf; include PHPWG_THEMES_PATH . 'smartpocket/admin/upgrade.inc.php'; load_language('theme.lang', PHPWG_THEMES_PATH . 'smartpocket/'); $config_send = array(); if (isset($_POST['submit_smartpocket'])) { $config_send['loop'] = isset($_POST['loop']); $config_send['autohide'] = isset($_POST['autohide']) ? 5000 : 0; $conf['smartpocket'] = serialize($config_send); conf_update_param('smartpocket', pwg_db_real_escape_string($conf['smartpocket'])); array_push($page['infos'], l10n('Information data registered in database')); } $template->set_filenames(array('theme_admin_content' => dirname(__FILE__) . '/admin.tpl')); $template->assign('options', unserialize($conf['smartpocket'])); $template->assign_var_from_handle('ADMIN_CONTENT', 'theme_admin_content');
function content_55bbb466439198_53831883($_smarty_tpl) { if (!is_callable('smarty_modifier_replace')) { include '/var/www/include/smarty/libs/plugins/modifier.replace.php'; } ?> <!DOCTYPE html> <html lang="<?php echo $_smarty_tpl->tpl_vars['lang_info']->value['code']; ?> " dir="<?php echo $_smarty_tpl->tpl_vars['lang_info']->value['direction']; ?> "> <head> <meta charset="<?php echo $_smarty_tpl->tpl_vars['CONTENT_ENCODING']->value; ?> "> <meta name="generator" content="Piwigo (aka PWG), see piwigo.org"> <?php if (isset($_smarty_tpl->tpl_vars['meta_ref']->value)) { ?> <?php if (isset($_smarty_tpl->tpl_vars['INFO_AUTHOR']->value)) { ?> <meta name="author" content="<?php echo smarty_modifier_replace(strip_tags($_smarty_tpl->tpl_vars['INFO_AUTHOR']->value), '"', ' '); ?> "> <?php } if (isset($_smarty_tpl->tpl_vars['related_tags']->value)) { ?> <meta name="keywords" content="<?php $_smarty_tpl->tpl_vars['tag'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['tag']->_loop = false; $_from = $_smarty_tpl->tpl_vars['related_tags']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['tag']->index = -1; foreach ($_from as $_smarty_tpl->tpl_vars['tag']->key => $_smarty_tpl->tpl_vars['tag']->value) { $_smarty_tpl->tpl_vars['tag']->_loop = true; $_smarty_tpl->tpl_vars['tag']->index++; $_smarty_tpl->tpl_vars['tag']->first = $_smarty_tpl->tpl_vars['tag']->index === 0; $_smarty_tpl->tpl_vars['smarty']->value['foreach']['tag_loop']['first'] = $_smarty_tpl->tpl_vars['tag']->first; if (!$_smarty_tpl->getVariable('smarty')->value['foreach']['tag_loop']['first']) { ?> , <?php } echo $_smarty_tpl->tpl_vars['tag']->value['name']; } ?> "> <?php } if (isset($_smarty_tpl->tpl_vars['COMMENT_IMG']->value)) { ?> <meta name="description" content="<?php echo smarty_modifier_replace(strip_tags($_smarty_tpl->tpl_vars['COMMENT_IMG']->value), '"', ' '); if (isset($_smarty_tpl->tpl_vars['INFO_FILE']->value)) { ?> - <?php echo $_smarty_tpl->tpl_vars['INFO_FILE']->value; } ?> "> <?php } else { ?> <meta name="description" content="<?php echo $_smarty_tpl->tpl_vars['PAGE_TITLE']->value; if (isset($_smarty_tpl->tpl_vars['INFO_FILE']->value)) { ?> - <?php echo $_smarty_tpl->tpl_vars['INFO_FILE']->value; } ?> "> <?php } } ?> <title><?php if ($_smarty_tpl->tpl_vars['PAGE_TITLE']->value != l10n('Home') && $_smarty_tpl->tpl_vars['PAGE_TITLE']->value != $_smarty_tpl->tpl_vars['GALLERY_TITLE']->value) { echo $_smarty_tpl->tpl_vars['PAGE_TITLE']->value; ?> | <?php } echo $_smarty_tpl->tpl_vars['GALLERY_TITLE']->value; ?> </title> <link rel="shortcut icon" type="image/x-icon" href="<?php echo $_smarty_tpl->tpl_vars['ROOT_URL']->value; echo $_smarty_tpl->tpl_vars['themeconf']->value['icon_dir']; ?> /favicon.ico"> <link rel="start" title="<?php echo l10n('Home'); ?> " href="<?php echo $_smarty_tpl->tpl_vars['U_HOME']->value; ?> " > <link rel="search" title="<?php echo l10n('Search'); ?> " href="<?php echo $_smarty_tpl->tpl_vars['ROOT_URL']->value; ?> search.php" > <?php if (isset($_smarty_tpl->tpl_vars['first']->value['U_IMG'])) { ?> <link rel="first" title="<?php echo l10n('First'); ?> " href="<?php echo $_smarty_tpl->tpl_vars['first']->value['U_IMG']; ?> " ><?php } if (isset($_smarty_tpl->tpl_vars['previous']->value['U_IMG'])) { ?> <link rel="prev" title="<?php echo l10n('Previous'); ?> " href="<?php echo $_smarty_tpl->tpl_vars['previous']->value['U_IMG']; ?> " ><?php } if (isset($_smarty_tpl->tpl_vars['next']->value['U_IMG'])) { ?> <link rel="next" title="<?php echo l10n('Next'); ?> " href="<?php echo $_smarty_tpl->tpl_vars['next']->value['U_IMG']; ?> " ><?php } if (isset($_smarty_tpl->tpl_vars['last']->value['U_IMG'])) { ?> <link rel="last" title="<?php echo l10n('Last'); ?> " href="<?php echo $_smarty_tpl->tpl_vars['last']->value['U_IMG']; ?> " ><?php } if (isset($_smarty_tpl->tpl_vars['U_UP']->value)) { ?> <link rel="up" title="<?php echo l10n('Thumbnails'); ?> " href="<?php echo $_smarty_tpl->tpl_vars['U_UP']->value; ?> " ><?php } ?> <?php if (isset($_smarty_tpl->tpl_vars['U_PREFETCH']->value)) { ?> <link rel="prefetch" href="<?php echo $_smarty_tpl->tpl_vars['U_PREFETCH']->value; ?> "><?php } if (isset($_smarty_tpl->tpl_vars['U_CANONICAL']->value)) { ?> <link rel="canonical" href="<?php echo $_smarty_tpl->tpl_vars['U_CANONICAL']->value; ?> "><?php } ?> <?php if (!empty($_smarty_tpl->tpl_vars['page_refresh']->value)) { ?> <meta http-equiv="refresh" content="<?php echo $_smarty_tpl->tpl_vars['page_refresh']->value['TIME']; ?> ;url=<?php echo $_smarty_tpl->tpl_vars['page_refresh']->value['U_REFRESH']; ?> "><?php } ?> <?php $_smarty_tpl->tpl_vars['theme'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['theme']->_loop = false; $_from = $_smarty_tpl->tpl_vars['themes']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['theme']->key => $_smarty_tpl->tpl_vars['theme']->value) { $_smarty_tpl->tpl_vars['theme']->_loop = true; ?> <?php if ($_smarty_tpl->tpl_vars['theme']->value['load_css']) { ?> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['combine_css'][0][0]->func_combine_css(array('path' => "themes/" . (string) $_smarty_tpl->tpl_vars['theme']->value['id'] . "/theme.css", 'order' => -10), $_smarty_tpl); ?> <?php } ?> <?php if (!empty($_smarty_tpl->tpl_vars['theme']->value['local_head'])) { ?> <?php echo $_smarty_tpl->getSubTemplate($_smarty_tpl->tpl_vars['theme']->value['local_head'], $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array('load_css' => $_smarty_tpl->tpl_vars['theme']->value['load_css']), 0); ?> <?php } ?> <?php } ?> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['combine_script'][0][0]->func_combine_script(array('id' => "jquery", 'load' => "footer"), $_smarty_tpl); ?> <!-- BEGIN get_combined --> <!-- COMBINED_CSS --> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['get_combined_scripts'][0][0]->func_get_combined_scripts(array('load' => 'header'), $_smarty_tpl); ?> <!-- END get_combined --> <!--[if lt IE 7]> <script type="text/javascript" src="<?php echo $_smarty_tpl->tpl_vars['ROOT_URL']->value; ?> themes/default/js/pngfix.js"></script> <![endif]--> <?php if (!empty($_smarty_tpl->tpl_vars['head_elements']->value)) { $_smarty_tpl->tpl_vars['elt'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['elt']->_loop = false; $_from = $_smarty_tpl->tpl_vars['head_elements']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['elt']->key => $_smarty_tpl->tpl_vars['elt']->value) { $_smarty_tpl->tpl_vars['elt']->_loop = true; ?> <?php echo $_smarty_tpl->tpl_vars['elt']->value; ?> <?php } } ?> </head> <body id="<?php echo $_smarty_tpl->tpl_vars['BODY_ID']->value; ?> "> <div id="the_page"> <?php if (!empty($_smarty_tpl->tpl_vars['header_msgs']->value)) { ?> <div class="header_msgs"> <?php $_smarty_tpl->tpl_vars['elt'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['elt']->_loop = false; $_from = $_smarty_tpl->tpl_vars['header_msgs']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['elt']->key => $_smarty_tpl->tpl_vars['elt']->value) { $_smarty_tpl->tpl_vars['elt']->_loop = true; ?> <?php echo $_smarty_tpl->tpl_vars['elt']->value; ?> <br> <?php } ?> </div> <?php } ?> <div id="theHeader"><?php echo $_smarty_tpl->tpl_vars['PAGE_BANNER']->value; ?> </div> <?php if (!empty($_smarty_tpl->tpl_vars['header_notes']->value)) { ?> <div class="header_notes"> <?php $_smarty_tpl->tpl_vars['elt'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['elt']->_loop = false; $_from = $_smarty_tpl->tpl_vars['header_notes']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['elt']->key => $_smarty_tpl->tpl_vars['elt']->value) { $_smarty_tpl->tpl_vars['elt']->_loop = true; ?> <p><?php echo $_smarty_tpl->tpl_vars['elt']->value; ?> </p> <?php } ?> </div> <?php } }
$bound_tpl = 'N/A'; } if ($handle != 'N/A') { $replacements[$newtpl] = array($handle, $url_keyword, $bound_tpl); } $i++; } $conf['extents_for_templates'] = serialize($replacements); $tpl_extension = $replacements; /* ecrire la nouvelle conf */ $query = ' UPDATE ' . CONFIG_TABLE . ' SET value = \'' . $conf['extents_for_templates'] . '\' WHERE param = \'extents_for_templates\';'; if (pwg_query($query)) { $page['infos'][] = l10n('Templates configuration has been recorded.'); } } // +-----------------------------------------------------------------------+ // | template init | // +-----------------------------------------------------------------------+ /* Clearing (remove old extents, add new ones) */ foreach ($tpl_extension as $file => $conditions) { if (!in_array($file, $new_extensions)) { unset($tpl_extension[$file]); } else { $new_extensions = array_diff($new_extensions, array($file)); } } foreach ($new_extensions as $file) { $tpl_extension[$file] = array('N/A', 'N/A', 'N/A');
if (isset($error_copy)) { $errors[] = $error_copy; } else { session_set_save_handler('pwg_session_open', 'pwg_session_close', 'pwg_session_read', 'pwg_session_write', 'pwg_session_destroy', 'pwg_session_gc'); if (function_exists('ini_set')) { ini_set('session.use_cookies', $conf['session_use_cookies']); ini_set('session.use_only_cookies', $conf['session_use_only_cookies']); ini_set('session.use_trans_sid', intval($conf['session_use_trans_sid'])); ini_set('session.cookie_httponly', 1); } session_name($conf['session_name']); session_set_cookie_params(0, cookie_path()); register_shutdown_function('session_write_close'); $user = build_user(1, true); log_user($user['id'], false); // email notification if (isset($_POST['send_password_by_mail'])) { include_once PHPWG_ROOT_PATH . 'include/functions_mail.inc.php'; $keyargs_content = array(get_l10n_args('Hello %s,', $admin_name), get_l10n_args('Welcome to your new installation of Piwigo!', ''), get_l10n_args('', ''), get_l10n_args('Here are your connection settings', ''), get_l10n_args('', ''), get_l10n_args('Link: %s', get_absolute_root_url()), get_l10n_args('Username: %s', $admin_name), get_l10n_args('Password: %s', $admin_pass1), get_l10n_args('Email: %s', $admin_mail), get_l10n_args('', ''), get_l10n_args('Don\'t hesitate to consult our forums for any help: %s', PHPWG_URL)); pwg_mail($admin_mail, array('subject' => l10n('Just another Piwigo gallery'), 'content' => l10n_args($keyargs_content), 'content_format' => 'text/plain')); } } } if (count($errors) != 0) { $template->assign('errors', $errors); } if (count($infos) != 0) { $template->assign('infos', $infos); } //----------------------------------------------------------- html code display $template->pparse('install');
<?php defined('FLICKR_PATH') or die('Hacking attempt!'); if (isset($_POST['save_config'])) { $conf['flickr2piwigo'] = array('api_key' => trim($_POST['api_key']), 'secret_key' => trim($_POST['secret_key'])); unset($_SESSION['phpFlickr_auth_token']); conf_update_param('flickr2piwigo', $conf['flickr2piwigo']); $page['infos'][] = l10n('Information data registered in database'); } $template->assign(array('flickr2piwigo' => $conf['flickr2piwigo'], 'FLICKR_HELP_CONTENT' => load_language('help_api_key.html', FLICKR_PATH, array('return' => true)), 'FLICKR_CALLBACK' => get_absolute_root_url() . FLICKR_ADMIN . '-import')); $template->set_filename('flickr2piwigo', realpath(FLICKR_PATH . 'admin/template/config.tpl'));
* 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');
list($tpl_var['w'], $tpl_var['h']) = $params->sizing->ideal_size; if (($tpl_var['crop'] = round(100 * $params->sizing->max_crop)) > 0) { list($tpl_var['minw'], $tpl_var['minh']) = $params->sizing->min_size; } else { $tpl_var['minw'] = $tpl_var['minh'] = ""; } $tpl_var['sharpen'] = $params->sharpen; } $tpl_vars[$type] = $tpl_var; } $template->assign('derivatives', $tpl_vars); $template->assign('resize_quality', ImageStdParams::$quality); $tpl_vars = array(); $now = time(); foreach (ImageStdParams::$custom as $custom => $time) { $tpl_vars[$custom] = $now - $time <= 24 * 3600 ? l10n('today') : time_since($time, 'day'); } $template->assign('custom_derivatives', $tpl_vars); } break; case 'watermark': $watermark_files = array(); foreach (glob(PHPWG_ROOT_PATH . 'themes/default/watermarks/*.png') as $file) { $watermark_files[] = substr($file, strlen(PHPWG_ROOT_PATH)); } if (($glob = glob(PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'watermarks/*.png')) !== false) { foreach ($glob as $file) { $watermark_files[] = substr($file, strlen(PHPWG_ROOT_PATH)); } } $watermark_filemap = array('' => '---');