Example #1
0
 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;
 }
Example #2
0
function GDThumb_index()
{
    global $template;
    $template->smarty->registerPlugin("function", "media_type", "GDThumb_media_type");
    $template->set_prefilter('index', 'GDThumb_prefilter');
    add_event_handler('loc_end_index_thumbnails', 'GDThumb_process_thumb', 50, 2);
}
 public function init()
 {
     $this->setPluginWarnings();
     add_event_handler('loc_begin_page_header', array($this, 'assignConfig'));
     $shortname = $this->config->comments_disqus_shortname;
     if ($this->config->comments_type == 'disqus' && !empty($shortname)) {
         add_event_handler('blockmanager_apply', array($this, 'hideMenus'));
     }
 }
Example #4
0
function Fotorama_element_content($content)
{
    global $page;
    if (Fotorama_is_replace_picture()) {
        $page['slideshow'] = true;
    }
    if ($page['slideshow']) {
        add_event_handler('loc_end_page_header', 'Fotorama_end_page_header');
    }
    return $content;
}
Example #5
0
function polaroid_index()
{
    global $template, $page, $conf;
    if ($conf['polaroid']['apply_to_albums'] == 'list') {
        if (!isset($page['category'])) {
            return;
        }
        if (!$page['category']['polaroid_active']) {
            return;
        }
    }
    $template->set_prefilter('index', 'polaroid_prefilter');
    add_event_handler('loc_end_index_thumbnails', 'process_polaroid', 50, 2);
}
<?php

/*
Plugin Name: Comments Access Manager
Version: auto
Description: Gérer l'accès aux commentaites - Manage comments access
Plugin URI: http://piwigo.org/ext/extension_view.php?eid=545
Author: Eric
Author URI: http://www.infernoweb.net
*/
/* History:  CM_PATH.'Changelog.txt' */
if (!defined('PHPWG_ROOT_PATH')) {
    die('Hacking attempt!');
}
if (!defined('CM_PATH')) {
    define('CM_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
}
global $conf;
include_once CM_PATH . 'include/functions.inc.php';
// Plugin administration panel
add_event_handler('get_admin_plugin_menu_links', 'CM_admin_menu');
// Comments authorisation check
add_event_handler('user_comment_check', 'CM_CheckComment', 50, 2);
// Comments on album authorisation check
add_event_handler('user_comment_check_albums', 'CM_CheckComment', 50, 2);
$this->assign('thumbnail_derivative_params', ImageStdParams::get_by_type(IMG_SQUARE));
//------------------------------------------------------------- mobile version & theme config
add_event_handler('init', 'mobile_link');
function mobile_link()
{
    global $template, $conf;
    $config = unserialize($conf['smartpocket']);
    $template->assign('smartpocket', $config);
    if (!empty($conf['mobile_theme']) && (get_device() != 'desktop' || mobile_theme())) {
        $template->assign(array('TOGGLE_MOBILE_THEME_URL' => add_url_params(htmlspecialchars($_SERVER['REQUEST_URI']), array('mobile' => mobile_theme() ? 'false' : 'true'))));
    }
}
if (!function_exists('add_menu_on_public_pages')) {
    if (defined('IN_ADMIN') and IN_ADMIN) {
        return false;
    }
    add_event_handler('loc_after_page_header', 'add_menu_on_public_pages', 20);
    function add_menu_on_public_pages()
    {
        if (function_exists('initialize_menu')) {
            return false;
        }
        # The current page has already the menu
        global $template, $page, $conf;
        if (isset($page['body_id']) and $page['body_id'] == "thePicturePage") {
            $template->set_filenames(array('add_menu_on_public_pages' => dirname(__FILE__) . '/template/add_menu_on_public_pages.tpl'));
            include_once PHPWG_ROOT_PATH . 'include/menubar.inc.php';
            $template->parse('add_menu_on_public_pages');
        }
    }
}
Example #8
0
    //add_event_handler('get_src_image_url', 'cdnplus_update_url'); // picture page
    //add_event_handler('get_derivative_url', 'cdnplus_update_url'); // thumbnailCategory & thumbnail & navThumb
    // Find which CDN to use for theme and enabled the trigger
    for ($i = 1; $i <= 5; $i++) {
        if (!empty($conf['cdnplus_conf']['cdn_' . $i]['host']) && !empty($conf['cdnplus_conf']['cdn_' . $i]['theme'])) {
            $cdnUrl = 'http://';
            if (!empty($_SERVER['HTTPS']) && !empty($conf['cdnplus_conf']['cdn_' . $i]['keep_https'])) {
                $cdnUrl = 'https://';
            }
            define('CDNPLUS', $cdnUrl . $conf['cdnplus_conf']['cdn_' . $i]['host']);
            define('CDNPLUS_ROOT_URL', CDNPLUS . get_absolute_root_url(false));
            add_event_handler('get_combined_css', 'cdnplus_combined_css', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
            // update CSS
            add_event_handler('combined_script', 'cdnplus_combined_script', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
            // update Javascript
            add_event_handler('combined_css_postfilter', 'cdnplus_combined_css_postfilter');
            // ?
        }
    }
}
function cdnplus_prefilter($source, &$smarty)
{
    $source = str_replace('src="{$ROOT_URL}{$themeconf.icon_dir}/', 'src="' . CDNPLUS_ROOT_URL . '{$themeconf.icon_dir}/', $source);
    $source = str_replace('url({$' . 'ROOT_URL}', 'url(' . CDNPLUS_ROOT_URL, $source);
    return $source;
}
function cdnplus_combined_script($url, $script)
{
    if (!$script->is_remote()) {
        $url = CDNPLUS_ROOT_URL . $script->path;
    }
        $style .= 'border-radius:10px;';
        $style .= 'margin-left:5px;';
        $name .= '<span style="' . $style . '">' . $page['pfemail_nb_pendings'] . '</span>';
    }
    array_push($menu, array('NAME' => $name, 'URL' => get_root_url() . 'admin.php?page=plugin-photo_from_email'));
    return $menu;
}
add_event_handler('loc_end_page_tail', 'pfemail_call_check');
function pfemail_call_check()
{
    global $template, $conf;
    if (isset($conf['pfemail_last_check'])) {
        // check emails maximum every minute
        if (strtotime($conf['pfemail_last_check']) > strtotime('-1 minute')) {
            return;
        }
    }
    $template->set_filename('check_email_js', realpath(PFEMAIL_PATH . 'check_email.tpl'));
    $template->parse('check_email_js');
}
add_event_handler('ws_add_methods', 'pfemail_add_methods');
function pfemail_add_methods($arr)
{
    $service =& $arr[0];
    $service->addMethod('pwg.pfemail.check', 'ws_pfemail_check', array(), 'Check photo from email');
    $service->addMethod('pwg.pfemail.validate', 'ws_pfemail_validate', array('image_id' => array('default' => null)), 'Validate photo from email', null, array('admin_only' => true));
    $service->addMethod('pwg.pfemail.reject', 'ws_pfemail_reject', array('image_id' => array('default' => null)), 'Reject photo from email', null, array('admin_only' => true));
    $service->addMethod('pfemail.mailbox.save', 'ws_pfemail_mailbox_save', array('id' => array('default' => null, 'type' => WS_TYPE_ID), 'path' => array('default' => null), 'login' => array('default' => null), 'password' => array('default' => null), 'category_id' => array('default' => null, 'type' => WS_TYPE_ID), 'moderated' => array('default' => true, 'type' => WS_TYPE_BOOL), 'pwg_token' => array()), 'Add or edit a mailbox', null, array('admin_only' => true));
    $service->addMethod('pfemail.mailbox.delete', 'ws_pfemail_mailbox_delete', array('id' => array('type' => WS_TYPE_ID), 'pwg_token' => array()), 'Delete a mailbox', null, array('admin_only' => true));
    $service->addMethod('pfemail.mailbox.test', 'ws_pfemail_mailbox_test', array('path' => array('default' => null), 'login' => array('default' => null), 'password' => array('default' => null), 'pwg_token' => array()), 'Test mailbox connection settings', null, array('admin_only' => true));
}
Plugin Name: External Reference
Version: auto
Description: Add external reference to album
Plugin URI: http://piwigo.org/ext/extension_view.php?eid=
Author: plg
Author URI: http://le-gall.net/pierrick
*/
defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
global $prefixeTable;
// +-----------------------------------------------------------------------+
// | Define plugin constants                                               |
// +-----------------------------------------------------------------------+
defined('EXTREF_ID') or define('EXTREF_ID', basename(dirname(__FILE__)));
define('EXTREF_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
define('EXTREF_VERSION', 'auto');
add_event_handler('ws_add_methods', 'extref_add_methods');
function extref_add_methods($arr)
{
    $service =& $arr[0];
    $service->addMethod('extref.categories.get', 'ws_extref_categories_get', array('category_id' => array('default' => null, 'type' => WS_TYPE_ID), 'external_reference' => array('default' => null), 'exact_match' => array('default' => false, 'type' => WS_TYPE_BOOL), 'show_empty' => array('default' => false, 'type' => WS_TYPE_BOOL)), 'List external references on albums');
    $service->addMethod('extref.categories.set', 'ws_extref_categories_set', array('category_id' => array('default' => null, 'type' => WS_TYPE_ID), 'external_reference' => array()), 'Set external references on album', null, array('admin_only' => true, 'post_only' => true));
}
function ws_extref_categories_get($params, &$service)
{
    $where = array('1=1');
    // always true
    if (!empty($params['category_id'])) {
        $where[] = 'id = ' . $params['category_id'];
    }
    if (!empty($params['external_reference'])) {
        if ($params['exact_match']) {
Example #11
0
defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
if (basename(dirname(__FILE__)) != 'GuestBook') {
    add_event_handler('init', 'guestbook_error');
    function guestbook_error()
    {
        global $page;
        $page['errors'][] = 'GuestBook folder name is incorrect, uninstall the plugin and rename it to "GuestBook"';
    }
    return;
}
global $conf, $prefixeTable;
define('GUESTBOOK_PATH', PHPWG_PLUGINS_PATH . 'GuestBook/');
define('GUESTBOOK_TABLE', $prefixeTable . 'guestbook');
define('GUESTBOOK_ADMIN', get_root_url() . 'admin.php?page=plugin-GuestBook');
define('GUESTBOOK_URL', get_absolute_root_url() . make_index_url(array('section' => 'guestbook')));
$conf['guestbook'] = safe_unserialize($conf['guestbook']);
include_once GUESTBOOK_PATH . 'include/events.inc.php';
add_event_handler('loading_lang', 'guestbook_loading_lang');
if (defined('IN_ADMIN')) {
    add_event_handler('get_admin_plugin_menu_links', 'gb_admin_menu');
} else {
    add_event_handler('loc_end_section_init', 'gb_section_init');
    add_event_handler('loc_end_index', 'gb_index');
}
if ($conf['guestbook']['menu_link']) {
    add_event_handler('blockmanager_apply', 'gb_menubar_apply', EVENT_HANDLER_PRIORITY_NEUTRAL + 10);
}
function guestbook_loading_lang()
{
    load_language('plugin.lang', GUESTBOOK_PATH);
}
Example #12
0
        include_once REGPHPBB_PATH . 'include/functions.inc.php';
        if (isset($_POST['validate']) and !is_admin()) {
            if (!empty($_POST['use_new_pwd'])) {
                $query = '
SELECT ' . $conf['user_fields']['username'] . ' AS username
FROM ' . USERS_TABLE . '
WHERE ' . $conf['user_fields']['id'] . ' = \'' . $user['id'] . '\'
;';
                list($username) = pwg_db_fetch_row(pwg_query($query));
                PhpBB_Updateuser($user['id'], stripslashes($username), md5($_POST['use_new_pwd']), $_POST['mail_address']);
            }
        }
    }
}
/* Access validation in PhpBB when validated in Piwigo through UAM plugin */
add_event_handler('login_success', 'UAM_Bridge', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
function UAM_Bridge()
{
    global $conf, $user;
    $conf_Register_PhpBB = isset($conf['Register_PhpBB']) ? explode(";", $conf['Register_PhpBB']) : array();
    // Check if UAM is installed and if bridge is set - Exception for admins and webmasters
    $query = '
SELECT user_id, status
FROM ' . USER_INFOS_TABLE . '
WHERE user_id = ' . $user['id'] . '
;';
    $data = pwg_db_fetch_assoc(pwg_query($query));
    if ($data['status'] != "admin" and $data['status'] != "webmaster") {
        if (function_exists('FindAvailableConfirmMailID') and isset($conf_Register_PhpBB[5]) and $conf_Register_PhpBB[5] == 'true') {
            $conf_UAM = unserialize($conf['UserAdvManager']);
            // Getting unvalidated users group else Piwigo's default group
Example #13
0
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
global $conf;
if (!defined('PHPWG_ROOT_PATH')) {
    die('Hacking attempt!');
}
define('STEREO_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
define('STEREO_MODE_COOKIE', 'piwigo_stereo_mode');
define('STEREO_MODE_GIF', 'gif');
define('STEREO_MODE_CROSS_EYED', 'cross');
define('STEREO_MODE_WALL_EYED', 'wall');
$conf['picture_ext'][] = 'mpo';
include_once __DIR__ . '/include/functions.php';
add_event_handler('render_element_content', 'Stereo_render_element_content', 40, 2);
//TODO: what are these numbers?
add_event_handler('tabsheet_before_select', 'Stereo_tabsheet');
add_event_handler('loc_end_element_set_global', 'Stereo_loc_end_element_set_global');
add_event_handler('element_set_global_action', 'Stereo_element_set_global_action', 40, 2);
add_event_handler('get_batch_manager_prefilters', 'Stereo_get_batch_manager_prefilters');
add_event_handler('perform_batch_manager_prefilters', 'Stereo_perform_batch_manager_prefilters', 40, 2);
Example #14
0
    die('Hacking attempt!');
}
// +-----------------------------------------------------------------------+
// | Define plugin constants                                               |
// +-----------------------------------------------------------------------+
define('LDAP_LOGIN_ID', basename(dirname(__FILE__)));
define('LDAP_LOGIN_PATH', __DIR__ . '/');
define('LDAP_LOGIN_ADMIN', get_root_url() . 'admin.php?page=plugin-' . LDAP_LOGIN_ID);
define('LDAP_LOGIN_VERSION', '1.2');
include_once LDAP_LOGIN_PATH . '/class.ldap.php';
// +-----------------------------------------------------------------------+
// | Event handlers                                                        |
// +-----------------------------------------------------------------------+
add_event_handler('init', 'ld_init');
add_event_handler('try_log_user', 'login', 0, 4);
add_event_handler('get_admin_plugin_menu_links', array(&$ldap, 'ldap_admin_menu'));
// +-----------------------------------------------------------------------+
// | Admin menu loading                                                    |
// +-----------------------------------------------------------------------+
$ldap = new Ldap();
$ldap->load_config();
set_plugin_data($plugin['id'], $ldap);
unset($ldap);
// +-----------------------------------------------------------------------+
// | functions                                                             |
// +-----------------------------------------------------------------------+
function random_password($length = 8)
{
    $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#\$%^&*()_-=+;:,.?";
    $password = substr(str_shuffle($chars), 0, $length);
    return $password;
 function __construct()
 {
     add_event_handler('list_check_integrity', array(&$this, 'c13y_version'));
     add_event_handler('list_check_integrity', array(&$this, 'c13y_exif'));
     add_event_handler('list_check_integrity', array(&$this, 'c13y_user'));
 }
Example #16
0
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
************************************************/
// Hook to add the div in the right menu, No idea about the number!!
add_event_handler('loc_begin_picture', 'forecast_loc_begin_picture', 56);
// Hook to populate the div in the right menu, No idea about the number after!!
add_event_handler('loc_begin_picture', 'forecast_render_element_content', EVENT_HANDLER_PRIORITY_NEUTRAL + 1, 2);
function forecast_loc_begin_picture()
{
    global $template;
    $template->set_prefilter('picture', 'forecast_insert_map');
}
function forecast_insert_map($content, &$smarty)
{
    global $conf;
    load_language('plugin.lang', FORECAST_PATH);
    $search = '#<div id="' . $conf['forecast_conf']['add_before'] . '" class="imageInfo">#';
    $replacement = '
{if $FORECAST_DATA}
<div id="forecast-info" class="imageInfo">
    <dt>{$FORECAST_NAME}</dt>
    <dd>
Example #17
0
            }
        }
    }
}
// There is cookie, so we must handle it at the beginning
if (isset($_GET['metadata'])) {
    if (pwg_get_session_var('show_metadata') == null) {
        pwg_set_session_var('show_metadata', 1);
    } else {
        pwg_unset_session_var('show_metadata');
    }
}
// add default event handler for rendering element content
add_event_handler('render_element_content', 'default_picture_content');
// add default event handler for rendering element description
add_event_handler('render_element_description', 'pwg_nl2br');
/**
 * pwg_nl2br is useful for PHP 5.2 which doesn't accept more than 1
 * parameter on nl2br() (and anyway the second parameter of nl2br does not
 * match what Piwigo gives.
 */
function pwg_nl2br($string)
{
    return nl2br($string);
}
trigger_notify('loc_begin_picture');
// this is the default handler that generates the display for the element
function default_picture_content($content, $element_info)
{
    global $conf;
    if (!empty($content)) {
        if (!isset($_POST['vjs_metadata-' . $id]) and !isset($_POST['vjs_poster-' . $id]) and !isset($_POST['vjs_thumb-' . $id])) {
            return;
        }
        // Override default value from the form
        $sync_options_form = array('metadata' => isset($_POST['vjs_metadata-' . $id]), 'poster' => isset($_POST['vjs_poster-' . $id]), 'postersec' => $_POST['vjs_postersec-' . $id], 'output' => $_POST['vjs_output-' . $id], 'posteroverlay' => isset($_POST['vjs_posteroverlay-' . $id]), 'posteroverwrite' => isset($_POST['vjs_posteroverwrite-' . $id]), 'thumb' => isset($_POST['vjs_thumb-' . $id]), 'thumbsec' => $_POST['vjs_thumbsec-' . $id], 'thumbsize' => $_POST['vjs_thumbsize-' . $id], 'simulate' => false, 'batch_manager' => true);
        $sync_options = array_merge(unserialize($conf['vjs_sync']), $sync_options_form);
        $query = "SELECT `id`, `file`, `path`\n\t\t\t\tFROM " . IMAGES_TABLE . "\n\t\t\t\tWHERE `id`='" . $id . "';";
        // Do the work, share with batch manager
        include dirname(__FILE__) . '/../include/function_sync2.php';
        $page['errors'] = array_merge($page['errors'], $errors);
        $page['infos'] = array_merge($page['infos'], $infos);
        $page['warnings'] = array_merge($page['warnings'], $warnings);
    }
}
// Hoook for batch manager in single mode
add_event_handler('loc_end_element_set_unit', 'vjs_loc_end_element_set_unit');
function vjs_loc_end_element_set_unit()
{
    global $template, $conf, $page, $is_category, $category_info;
    $var = $template->get_template_vars();
    if (!isset($var['elements'])) {
        return;
    }
    foreach ($var['elements'] as $element) {
        if (!empty($element['representative_ext']) and $element['representative_ext'] != NULL) {
            $template->set_prefilter('batch_manager_unit', 'vjs_prefilter_batch_manager_unit');
        }
    }
}
function vjs_prefilter_batch_manager_unit($content)
{
Example #19
0
    }
    return $pwg_hasher->CheckPassword($password, $hash);
}
/**
 * Tries to login a user given username and password (must be MySql escaped).
 *
 * @param string $username
 * @param string $password
 * @param bool $remember_me
 * @return bool
 */
function try_log_user($username, $password, $remember_me)
{
    return trigger_change('try_log_user', false, $username, $password, $remember_me);
}
add_event_handler('try_log_user', 'pwg_login');
/**
 * Default method for user login, can be overwritten with 'try_log_user' trigger.
 * @see try_log_user()
 *
 * @param string $username
 * @param string $password
 * @param bool $remember_me
 * @return bool
 */
function pwg_login($success, $username, $password, $remember_me)
{
    if ($success === true) {
        return true;
    }
    // we force the session table to be clean
Example #20
0
        global $page;
        $page['errors'][] = 'Flickr2Piwigo folder name is incorrect, uninstall the plugin and rename it to "flickr2piwigo"';
    }
    return;
}
global $conf;
define('FLICKR_PATH', PHPWG_PLUGINS_PATH . 'flickr2piwigo/');
define('FLICKR_ADMIN', get_root_url() . 'admin.php?page=plugin-flickr2piwigo');
define('FLICKR_FS_CACHE', PHPWG_ROOT_PATH . $conf['data_location'] . 'flickr_cache/');
include_once FLICKR_PATH . 'include/ws_functions.inc.php';
$conf['flickr2piwigo'] = safe_unserialize($conf['flickr2piwigo']);
add_event_handler('ws_add_methods', 'flickr_add_ws_method');
if (defined('IN_ADMIN')) {
    add_event_handler('get_admin_plugin_menu_links', 'flickr_admin_menu');
    add_event_handler('get_batch_manager_prefilters', 'flickr_add_batch_manager_prefilters');
    add_event_handler('perform_batch_manager_prefilters', 'flickr_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    function flickr_admin_menu($menu)
    {
        $menu[] = array('NAME' => 'Flickr2Piwigo', 'URL' => FLICKR_ADMIN);
        return $menu;
    }
    function flickr_add_batch_manager_prefilters($prefilters)
    {
        $prefilters[] = array('ID' => 'flickr', 'NAME' => l10n('Imported from Flickr'));
        return $prefilters;
    }
    function flickr_perform_batch_manager_prefilters($filter_sets, $prefilter)
    {
        if ($prefilter == 'flickr') {
            $query = '
  SELECT id
Example #21
0
    include_once PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php';
    if (check_upgrade_feed()) {
        $header_msgs[] = 'Some database upgrades are missing, ' . '<a href="' . get_absolute_root_url(false) . 'upgrade_feed.php">upgrade now</a>';
    }
}
if (count($header_msgs) > 0) {
    $template->assign('header_msgs', $header_msgs);
    $header_msgs = array();
}
if (!empty($conf['filter_pages']) and get_filter_page_value('used')) {
    include PHPWG_ROOT_PATH . 'include/filter.inc.php';
} else {
    $filter['enabled'] = false;
}
if (isset($conf['header_notes'])) {
    $header_notes = array_merge($header_notes, $conf['header_notes']);
}
// default event handlers
add_event_handler('render_category_literal_description', 'render_category_literal_description');
if (!$conf['allow_html_descriptions']) {
    add_event_handler('render_category_description', 'nl2br');
}
add_event_handler('render_comment_content', 'render_comment_content');
add_event_handler('render_comment_author', 'strip_tags');
add_event_handler('render_tag_url', 'str2url');
add_event_handler('blockmanager_register_blocks', 'register_default_menubar_blocks', EVENT_HANDLER_PRIORITY_NEUTRAL - 1);
if (!empty($conf['original_url_protection'])) {
    add_event_handler('get_element_url', 'get_element_url_protection_handler');
    add_event_handler('get_src_image_url', 'get_src_image_url_protection_handler');
}
trigger_notify('init');
Example #22
0
// Prepare configuration
$conf['vjs_conf'] = unserialize($conf['vjs_conf']);
// Register the allowed extentions to the global conf in order
// to sync them with other contents
$vjs_extensions = array('ogg', 'ogv', 'mp4', 'm4v', 'webm', 'webmv');
$conf['file_ext'] = array_merge($conf['file_ext'], $vjs_extensions, array_map('strtoupper', $vjs_extensions));
// Hook on to an event to display videos as standard images
add_event_handler('render_element_content', 'vjs_render_media', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
// Hook to display a fallback thumbnail if not defined
add_event_handler('get_mimetype_location', 'vjs_get_mimetype_icon', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
// Hook to change the picture data to template
//add_event_handler('picture_pictures_data', 'vjs_pictures_data');
// Hook to sync metadata on upload or sync
add_event_handler('format_exif_data', 'vjs_format_exif_data', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
// Hook to display metadata on picture page
add_event_handler('get_element_metadata_available', 'vjs_metadata_available');
// If admin do the init
if (defined('IN_ADMIN')) {
    include_once VIDEOJS_PATH . '/admin/admin_boot.php';
}
function vjs_format_exif_data($exif, $filename, $map)
{
    global $conf, $picture;
    //print_r( $picture['current']);
    // do nothing if the current picture is actually an image !
    if (!isset($picture['current'])) {
        return $exif;
    }
    if (array_key_exists('src_image', @$picture['current']) && @$picture['current']['src_image']->is_original()) {
        return $exif;
    }
Example #23
0
            $clauses[] = 'image_id IN (' . implode(', ', $search['image_ids']) . ')';
        }
    }
    if (isset($search['fields']['ip'])) {
        $clauses[] = 'IP LIKE "' . $search['fields']['ip'] . '"';
    }
    $clauses = prepend_append_array_items($clauses, '(', ')');
    $where_separator = implode("\n    AND ", $clauses);
    $query = '
SELECT
    date,
    time,
    user_id,
    IP,
    section,
    category_id,
    tag_ids,
    image_id,
    image_type
  FROM ' . HISTORY_TABLE . '
  WHERE ' . $where_separator . '
;';
    // LIMIT '.$conf['nb_logs_page'].' OFFSET '.$page['start'].'
    $result = pwg_query($query);
    while ($row = pwg_db_fetch_assoc($result)) {
        $data[] = $row;
    }
    return $data;
}
add_event_handler('get_history', 'get_history');
trigger_notify('functions_history_included');
Example #24
0
* Descr     :   Generate the admin panel
*
* Created   :   11.06.2013
*
* Copyright 2013-2015 <*****@*****.**>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
************************************************/
// Check whether we are indeed included by Piwigo.
if (!defined('PHPWG_ROOT_PATH')) {
    die('Hacking attempt!');
}
// Hook to a admin config page
add_event_handler('get_admin_plugin_menu_links', 'forecast_admin_menu');
function forecast_admin_menu($menu)
{
    array_push($menu, array('NAME' => 'Forecast', 'URL' => get_admin_plugin_menu_link(dirname(__FILE__) . '/admin.php')));
    return $menu;
}
    $filename = embellish_url(get_gallery_home_url() . $picture['current']['element_url']);
    $height = isset($conf['osm_conf']['gpx']['height']) ? $conf['osm_conf']['gpx']['height'] : '500';
    $width = isset($conf['osm_conf']['gpx']['width']) ? $conf['osm_conf']['gpx']['width'] : '320';
    $local_conf = array();
    $local_conf['contextmenu'] = 'false';
    $local_conf['control'] = true;
    $local_conf['img_popup'] = false;
    $local_conf['popup'] = 2;
    $local_conf['center_lat'] = 0;
    $local_conf['center_lng'] = 0;
    $local_conf['zoom'] = '12';
    $local_conf['divname'] = 'mapgpx';
    $js_data = array(array(null, null, null, null, null, null, null, null));
    $js = osm_get_js($conf, $local_conf, $js_data);
    // Select the template
    $template->set_filenames(array('osm_content' => dirname(__FILE__) . "/template/osm-gpx.tpl"));
    // Assign the template variables
    $template->assign(array('HEIGHT' => $height, 'WIDTH' => $width, 'FILENAME' => $filename, 'OSM_PATH' => embellish_url(get_gallery_home_url() . OSM_PATH), 'OSMGPX' => $js));
    // Return the rendered html
    $osm_content = $template->parse('osm_content', true);
    return $osm_content;
}
// Hook to display a fallback thumbnail if not defined
add_event_handler('get_mimetype_location', 'osm_get_mimetype_icon');
function osm_get_mimetype_icon($location, $element_info)
{
    if ($element_info == 'gpx') {
        $location = 'plugins/' . basename(dirname(__FILE__)) . '/mimetypes/' . $element_info . '.png';
    }
    return $location;
}
// Plugin on picture page
if (script_basename() == 'picture') {
    include_once dirname(__FILE__) . '/picture.inc.php';
} elseif (script_basename() == 'index') {
    include_once dirname(__FILE__) . '/category.inc.php';
    include_once dirname(__FILE__) . '/menu.inc.php';
}
// Do we have to show a link on the left menu
if ($conf['osm_conf']['left_menu']['enabled']) {
    // Hook to add link on the left menu
    add_event_handler('blockmanager_apply', 'osm_blockmanager_apply');
}
// Hook to add worldmap link on the album/category thumbnails
add_event_handler('loc_begin_index_category_thumbnails', 'osm_index_cat_thumbs_displayed');
// Hook to add worldmap link on the index thumbnails page
add_event_handler('loc_end_index', 'osm_end_index');
function osm_index_cat_thumbs_displayed()
{
    global $page;
    $page['osm_cat_thumbs_displayed'] = true;
}
define('OSM_ACTION_MODEL', '<a href="%s" title="%s" rel="nofollow" class="pwg-state-default pwg-button"%s><span class="pwg-icon pwg-icon-globe">&nbsp;</span><span class="pwg-button-text">%s</span></a>');
function osm_end_index()
{
    global $page, $filter, $template;
    if (isset($page['chronology_field']) || $filter['enabled']) {
        return;
    }
    if ('categories' == @$page['section']) {
        // flat or no flat ; has subcats or not;  ?
        if (!@$page['osm_cat_thumbs_displayed'] and empty($page['items'])) {
Example #27
0
{
    global $template;
    $template->set_prefilter('index', 'Pure_default_prefilter_index');
}
function Pure_default_prefilter_index($content, &$smarty)
{
    global $pattern;
    $r = $pattern['Pure_default_prefilter_index']['R'];
    $ps = $pattern['Pure_default_prefilter_index']['S'];
    foreach ($r as $i => $pr) {
        $content = preg_replace($ps[$i], $pr, $content);
    }
    return $content;
}
/************************************ picture.tpl ************************************/
add_event_handler('loc_begin_picture', 'Pure_default_picture');
function Pure_default_picture()
{
    global $template;
    $template->set_prefilter('picture', 'Pure_default_prefilter_picture');
}
function Pure_default_prefilter_picture($content, &$smarty)
{
    global $pattern;
    $r = $pattern['Pure_default_prefilter_picture']['R'];
    $ps = $pattern['Pure_default_prefilter_picture']['S'];
    foreach ($r as $i => $pr) {
        $content = preg_replace($ps[$i], $pr, $content);
    }
    return $content;
}
Example #28
0
        $nbm_user['check_key'] = find_available_check_key();
        // Save key
        array_push($check_key_list, $nbm_user['check_key']);
        // Insert new nbm_users
        array_push($inserts, array('user_id' => $user['id'], 'check_key' => $nbm_user['check_key'], 'enabled' => $_POST['NBM_Subscription']));
        mass_inserts(USER_MAIL_NOTIFICATION_TABLE, array('user_id', 'check_key', 'enabled'), $inserts);
    } elseif ($count != 0 and !empty($_POST['NBM_Subscription']) && in_array($_POST['NBM_Subscription'], array('true', 'false'))) {
        $query = '
UPDATE ' . USER_MAIL_NOTIFICATION_TABLE . '
  SET enabled = \'' . $_POST['NBM_Subscription'] . '\'
  WHERE user_id = \'' . $user['id'] . '\';';
        pwg_query($query);
    }
}
/* Adding NBMS in profile page */
add_event_handler('load_profile_in_template', 'NBMS_Load_Profile');
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));
Example #29
0
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+
define('PHPWG_ROOT_PATH', './');
define('IN_WS', true);
include_once PHPWG_ROOT_PATH . 'include/common.inc.php';
check_status(ACCESS_FREE);
if (!$conf['allow_web_services']) {
    page_forbidden('Web services are disabled');
}
include_once PHPWG_ROOT_PATH . 'include/ws_core.inc.php';
add_event_handler('ws_add_methods', 'ws_addDefaultMethods');
add_event_handler('ws_invoke_allowed', 'ws_isInvokeAllowed', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
$requestFormat = 'rest';
$responseFormat = null;
if (isset($_GET['format'])) {
    $responseFormat = $_GET['format'];
}
if (!isset($responseFormat) and isset($requestFormat)) {
    $responseFormat = $requestFormat;
}
$service = new PwgServer();
if (!is_null($requestFormat)) {
    $handler = null;
    switch ($requestFormat) {
        case 'rest':
            include_once PHPWG_ROOT_PATH . 'include/ws_protocols/rest_handler.php';
            $handler = new PwgRestRequestHandler();
Example #30
-1
define('ADMINTOOLS_ADMIN', get_root_url() . 'admin.php?page=plugin-' . ADMINTOOLS_ID);
include_once ADMINTOOLS_PATH . 'include/events.inc.php';
include_once ADMINTOOLS_PATH . 'include/MultiView.class.php';
global $MultiView;
$MultiView = new MultiView();
add_event_handler('init', 'admintools_init');
add_event_handler('user_init', array(&$MultiView, 'user_init'));
add_event_handler('init', array(&$MultiView, 'init'));
add_event_handler('ws_add_methods', array('MultiView', 'register_ws'));
add_event_handler('delete_user', array('MultiView', 'invalidate_cache'));
add_event_handler('register_user', array('MultiView', 'invalidate_cache'));
if (!defined('IN_ADMIN')) {
    add_event_handler('loc_after_page_header', 'admintools_add_public_controller');
    add_event_handler('loc_begin_picture', 'admintools_save_picture');
    add_event_handler('loc_begin_index', 'admintools_save_category');
} else {
    add_event_handler('loc_begin_page_header', 'admintools_add_admin_controller_setprefilter');
    add_event_handler('loc_after_page_header', 'admintools_add_admin_controller');
    add_event_handler('get_admin_plugin_menu_links', 'admintools_admin_link');
}
function admintools_init()
{
    global $conf;
    $conf['AdminTools'] = safe_unserialize($conf['AdminTools']);
    load_language('plugin.lang', ADMINTOOLS_PATH);
}
function admintools_admin_link($menu)
{
    $menu[] = array('NAME' => 'Admin Tools', 'URL' => ADMINTOOLS_ADMIN);
    return $menu;
}