function getOptionsSupported()
 {
     global $personalities;
     if (!extensionEnabled('print_album_menu') && (($m = getOption('garland_menu')) == 'garland' || $m == 'zenpage' || $m == 'garland')) {
         $note = '<p class="notebox">' . sprintf(gettext('<strong>Note:</strong> The <em>%s</em> custom menu makes use of the <em>print_album_menu</em> plugin.'), $m) . '</p>';
     } else {
         $note = '';
     }
     $options = array(gettext('Theme personality') => array('key' => 'garland_personality', 'type' => OPTION_TYPE_SELECTOR, 'selections' => $personalities, 'desc' => gettext('Select the theme personality')), gettext('Allow search') => array('key' => 'Allow_search', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Set to enable search form.')), gettext('Allow cloud') => array('key' => 'Allow_cloud', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Set to enable tag cloud for album page.')), gettext('Custom menu') => array('key' => 'garland_menu', 'type' => OPTION_TYPE_CUSTOM, 'desc' => gettext('Set this to the <em>menu_manager</em> menu you wish to use.') . $note));
     if (extensionEnabled('zenpage')) {
         global $_zp_CMS;
         $pages = $_zp_CMS->getPages(false);
         $list = array();
         foreach ($pages as $page) {
             $pageObj = newPage($page['titlelink']);
             if (!$pageObj->getShow()) {
                 $list[getBare(get_language_string($page['title']))] = $page['titlelink'];
             }
         }
         $options[gettext('Custom Homepage')] = array('key' => 'garland_customHome', 'type' => OPTION_TYPE_SELECTOR, 'selections' => $list, 'null_selection' => gettext('none'), 'desc' => gettext('Select the <em>pages</em> titlelink for the home page. Only unpublished pages are offered for selection.'));
     }
     if (getOption('garland_personality') == 'image_gallery') {
         $options[gettext('Image gallery transition')] = array('key' => 'garland_transition', 'type' => OPTION_TYPE_SELECTOR, 'selections' => array(gettext('None') => '', gettext('Fade') => 'fade', gettext('Shrink/grow') => 'resize', gettext('Horizontal') => 'slide-hori', gettext('Vertical') => 'slide-vert'), 'order' => 10, 'desc' => gettext('Transition effect for Image gallery'));
         $options[gettext('Image gallery caption')] = array('key' => 'garland_caption_location', 'type' => OPTION_TYPE_RADIO, 'buttons' => array(gettext('On image') => 'image', gettext('Separate') => 'separate', gettext('Omit') => 'none'), 'order' => 10.5, 'desc' => gettext('Location for Image gallery picture caption'));
     }
     return $options;
 }
 /**
  * Returns the extra content
  *
  * @return string
  */
 function getExtraContent($locale = NULL)
 {
     $text = $this->get("extracontent");
     if ($locale == 'all') {
         return zpFunctions::unTagURLs($text);
     } else {
         return applyMacros(zpFunctions::unTagURLs(get_language_string($text, $locale)));
     }
 }
Exemple #3
0
 function getOptionsSupported()
 {
     $unpublishedpages = query_full_array("SELECT title,titlelink FROM " . prefix('pages') . " WHERE `show` != 1 ORDER by `sort_order`");
     $list = array();
     foreach ($unpublishedpages as $page) {
         $list[get_language_string($page['title'])] = $page['titlelink'];
     }
     return array(gettext('Allow search') => array('key' => 'Allow_search', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Check to enable search form.')), gettext('News on index page') => array('key' => 'zenpage_zp_index_news', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext("Enable this if you want to show the news section’s first page on the <code>index.php</code> page.")), gettext('Homepage') => array('key' => 'zenpage_homepage', 'type' => OPTION_TYPE_SELECTOR, 'selections' => $list, 'null_selection' => gettext('none'), 'desc' => gettext("Choose here any <em>un-published Zenpage page</em> (listed by <em>titlelink</em>) to act as your site’s homepage instead the normal gallery index.") . "<p class='notebox'>" . gettext("<strong>Note:</strong> This of course overrides the <em>News on index page</em> option and your theme must be setup for this feature! Visit the theming tutorial for details.") . "</p>"), gettext('Use standard contact page') => array('key' => 'zenpage_contactpage', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Disable this if you do not want to use the separate contact page with the contact form. You can also use the codeblock of a page for this. See the contact_form plugin documentation for more info.')), gettext('Use custom menu') => array('key' => 'zenpage_custommenu', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext('Check this if you want to use the <em>menu_manager</em> plugin if enabled to build a custom menu instead of the separate standard ones. A standard menu named "zenpage" is created and used automatically.')));
 }
Exemple #4
0
 function __construct($user)
 {
     $this->table = 'albums';
     $this->name = $user;
     $this->owner = $user;
     $this->setTitle(get_language_string(getOption('favorites_title')));
     $this->setDesc(get_language_string(getOption('favorites_desc')));
     $this->imageSortDirection = getOption('favorites_image_sort_direction');
     $this->albumSortDirection = getOption('favorites_album_sort_direction');
     $this->imageSortType = getOption('favorites_image_sort_type');
     $this->albumSortType = getOption('favorites_album_sort_type');
     $list = query_full_array('SELECT `aux` FROM ' . prefix('plugin_storage') . ' WHERE `type`="favorites" AND `aux` REGEXP ' . db_quote('[[:<:]]' . $user . '[[:>:]]'));
     foreach ($list as $aux) {
         $instance = getSerializedArray($aux['aux']);
         if (isset($instance[1])) {
             $this->list[$instance[1]] = $instance[1];
         }
     }
 }
/**
 * returns the auth type of a guest login
 *
 * @param string $hint
 * @param string $show
 * @return string
 */
function checkForGuest(&$hint = NULL, &$show = NULL)
{
    global $_zp_gallery, $_zp_gallery_page, $_zp_current_zenpage_page, $_zp_current_category, $_zp_current_zenpage_news;
    $authType = zp_apply_filter('checkForGuest', NULL);
    if (!is_null($authType)) {
        return $authType;
    }
    if (in_context(ZP_SEARCH)) {
        // search page
        $hash = getOption('search_password');
        if (getOption('search_user') != '') {
            $show = true;
        }
        $hint = get_language_string(getOption('search_hint'));
        $authType = 'zp_search_auth';
        if (empty($hash)) {
            $hash = $_zp_gallery->getPassword();
            if ($_zp_gallery->getUser() != '') {
                $show = true;
            }
            $hint = $_zp_gallery->getPasswordHint();
            $authType = 'zp_gallery_auth';
        }
        if (!empty($hash) && zp_getCookie($authType) == $hash) {
            return $authType;
        }
    } else {
        if (!is_null($_zp_current_zenpage_news)) {
            $authType = $_zp_current_zenpage_news->checkAccess($hint, $show);
            return $authType;
        } else {
            if (isset($_GET['album'])) {
                // album page
                list($album, $image) = rewrite_get_album_image('album', 'image');
                if ($authType = checkAlbumPassword($album, $hint)) {
                    return $authType;
                } else {
                    $alb = newAlbum($album);
                    if ($alb->getUser() != '') {
                        $show = true;
                    }
                    return false;
                }
            } else {
                // other page
                $hash = $_zp_gallery->getPassword();
                if ($_zp_gallery->getUser() != '') {
                    $show = true;
                }
                $hint = $_zp_gallery->getPasswordHint();
                if (!empty($hash) && zp_getCookie('zp_gallery_auth') == $hash) {
                    return 'zp_gallery_auth';
                }
            }
        }
    }
    if (empty($hash)) {
        return 'zp_public_access';
    }
    return false;
}
/**
 * Outputs the rights checkbox table for admin
 *
 * @param $id int record id for the save
 * @param string $background background color
 * @param string $alterrights are the items changable
 * @param bit $rights rights of the admin
 */
function printAdminRightsTable($id, $background, $alterrights, $rights)
{
    $rightslist = sortMultiArray(Zenphoto_Authority::getRights(), array('set', 'value'));
    ?>
		<div class="box-rights">
			<strong><?php 
    echo gettext("Rights:");
    ?>
</strong>
			<?php 
    $element = 3;
    $activeset = false;
    ?>
			<input type="checkbox" name="<?php 
    echo $id;
    ?>
-rightsenabled" class="user-<?php 
    echo $id;
    ?>
" value="1" checked="checked" <?php 
    echo $alterrights;
    ?>
 style="display:none" />
			<?php 
    foreach ($rightslist as $rightselement => $right) {
        if ($right['display']) {
            if ($right['set'] != gettext('Pages') && $right['set'] != gettext('News') || extensionEnabled('zenpage')) {
                if ($activeset != $right['set']) {
                    if ($activeset) {
                        ?>
							</fieldset>
							<?php 
                    }
                    $activeset = $right['set'];
                    ?>
						<fieldset><legend><?php 
                    echo $activeset;
                    ?>
</legend>
							<?php 
                }
                ?>
						<label title="<?php 
                echo html_encode(get_language_string($right['hint']));
                ?>
">
							<input type="checkbox" name="<?php 
                echo $id . '-' . $rightselement;
                ?>
" id="<?php 
                echo $rightselement . '-' . $id;
                ?>
" class="user-<?php 
                echo $id;
                ?>
" value="<?php 
                echo $right['value'];
                ?>
"<?php 
                if ($rights & $right['value']) {
                    echo ' checked="checked"';
                }
                echo $alterrights;
                ?>
 /> <?php 
                echo $right['name'];
                ?>
						</label>
						<?php 
            } else {
                ?>
						<input type="hidden" name="<?php 
                echo $id . '-' . $rightselement;
                ?>
" id="<?php 
                echo $rightselement . '-' . $id;
                ?>
" value="<?php 
                echo $right['value'];
                ?>
" />
						<?php 
            }
        }
    }
    ?>
		</fieldset>
	</div>
	<?php 
}
/**
 * Prints the mail contact form, handles checks and the mail sending. It uses Zenphoto's check for valid e-mail address and website URL and also supports CAPTCHA.
 * The contact form itself is a separate file and is located within the /contact_form/form.php so that it can be style as needed.
 *
 * @param string $subject_override set to override the subject.
 */
function printContactForm($subject_override = '')
{
    global $_zp_UTF8, $_zp_captcha, $_processing_post, $_zp_current_admin_obj;
    $error = array();
    if (isset($_POST['sendmail'])) {
        $mailcontent = array();
        $mailcontent['title'] = getField('title');
        $mailcontent['name'] = getField('name');
        $mailcontent['company'] = getField('company');
        $mailcontent['street'] = getField('street');
        $mailcontent['city'] = getField('city');
        $mailcontent['state'] = getField('state');
        $mailcontent['postal'] = getField('postal');
        $mailcontent['country'] = getField('country');
        $mailcontent['email'] = getField('email');
        $mailcontent['website'] = getField('website');
        $mailcontent['phone'] = getField('phone');
        $mailcontent['subject'] = getField('subject');
        $mailcontent['message'] = getField('message', 1);
        // if you want other required fields or less add/modify their checks here
        if (getOption('contactform_title') == "required" && empty($mailcontent['title'])) {
            $error[1] = gettext("a title");
        }
        if (getOption('contactform_name') == "required" && empty($mailcontent['name'])) {
            $error[2] = gettext("a name");
        }
        if (getOption('contactform_company') == "required" && empty($mailcontent['company'])) {
            $error[3] = gettext("a company");
        }
        if (getOption('contactform_street') == "required" && empty($mailcontent['street'])) {
            $error[4] = gettext("a street");
        }
        if (getOption('contactform_city') == "required" && empty($mailcontent['city'])) {
            $error[5] = gettext("a city");
        }
        if (getOption('contactform_state') == "required" && empty($mailcontent['state'])) {
            $error[5] = gettext("a state");
        }
        if (getOption('contactform_postal') == "required" && empty($mailcontent['postal'])) {
            $error[5] = gettext("a postal code");
        }
        if (getOption('contactform_country') == "required" && empty($mailcontent['country'])) {
            $error[6] = gettext("a country");
        }
        if (getOption('contactform_email') == "required" && (empty($mailcontent['email']) || !is_valid_email_zp($mailcontent['email']))) {
            $error[7] = gettext("a valid email address");
        }
        if (getOption('contactform_website') == "required" && empty($mailcontent['website'])) {
            $error[8] = gettext('a website');
        } else {
            if (!empty($mailcontent['website'])) {
                if (substr($mailcontent['website'], 0, 7) != "http://") {
                    $mailcontent['website'] = "http://" . $mailcontent['website'];
                }
            }
        }
        if (getOption("contactform_phone") == "required" && empty($mailcontent['phone'])) {
            $error[9] = gettext("a phone number");
        }
        if (getOption("contactform_subject") == "required" && empty($mailcontent['subject'])) {
            $error[10] = gettext("a subject");
        }
        if (getOption("contactform_message") == "required" && empty($mailcontent['message'])) {
            $error[11] = gettext("a message");
        }
        // CAPTCHA start
        if (getOption("contactform_captcha")) {
            $code_ok = trim(sanitize($_POST['code_h']));
            $code = trim(sanitize($_POST['code']));
            if (!$_zp_captcha->checkCaptcha($code, $code_ok)) {
                $error[5] = gettext("the correct CAPTCHA verification code");
            }
            // no ticket
        }
        // CAPTCHA end
        // If required fields are empty or not valide print note
        if (count($error) != 0) {
            ?>
			<div class="errorbox">
				<h2>
				<?php 
            $err = $error;
            switch (count($err)) {
                case 1:
                    printf(gettext('Please enter %s. Thanks.'), array_shift($err));
                    break;
                case 2:
                    printf(gettext('Please enter %1$s and %2$s. Thanks.'), array_shift($err), array_shift($err));
                    break;
                default:
                    $list = '<ul class="errorlist">';
                    foreach ($err as $item) {
                        $list .= '<li>' . $item . '</li>';
                    }
                    $list .= '</ul>';
                    printf(gettext('Please enter: %sThanks.'), $list);
                    break;
            }
            ?>
				</h2>
			</div>
			<?php 
        } else {
            $mailaddress = $mailcontent['email'];
            $name = $mailcontent['name'];
            $subject = $mailcontent['subject'] . " (" . getBareGalleryTitle() . ")";
            $message = $mailcontent['message'] . "\n\n";
            if (!empty($mailcontent['title'])) {
                $message .= $mailcontent['title'];
            }
            if (!empty($mailcontent['name'])) {
                $message .= $mailcontent['name'] . "\n";
            }
            if (!empty($mailcontent['company'])) {
                $message .= $mailcontent['company'] . "\n";
            }
            if (!empty($mailcontent['street'])) {
                $message .= $mailcontent['street'] . "\n";
            }
            if (!empty($mailcontent['city'])) {
                $message .= $mailcontent['city'] . "\n";
            }
            if (!empty($mailcontent['state'])) {
                $message .= $mailcontent['state'] . "\n";
            }
            if (!empty($mailcontent['postal'])) {
                $message .= $mailcontent['postal'] . "\n";
            }
            if (!empty($mailcontent['country'])) {
                $message .= $mailcontent['country'] . "\n";
            }
            if (!empty($mailcontent['email'])) {
                $message .= $mailcontent['email'] . "\n";
            }
            if (!empty($mailcontent['phone'])) {
                $message .= $mailcontent['phone'] . "\n";
            }
            if (!empty($mailcontent['website'])) {
                $message .= $mailcontent['website'] . "\n";
            }
            $message .= "\n\n";
            if (getOption('contactform_confirm')) {
                echo get_language_string(getOption("contactform_confirmtext"));
                if (getOption('contactform_sendcopy')) {
                    echo get_language_string(getOption("contactform_sendcopy_text"));
                }
                ?>
				<div>
					<?php 
                $_processing_post = true;
                include getPlugin('contact_form/form.php', true);
                ?>
					<form id="confirm" action="<?php 
                echo sanitize($_SERVER['REQUEST_URI']);
                ?>
" method="post" accept-charset="UTF-8" style="float: left">
						<input type="hidden" id="confirm" name="confirm" value="confirm" />
						<input type="hidden" id="name" name="name"	value="<?php 
                echo html_encode($name);
                ?>
" />
						<input type="hidden" id="subject" name="subject"	value="<?php 
                echo html_encode($subject);
                ?>
" />
						<input type="hidden" id="message"	name="message" value="<?php 
                echo html_encode($message);
                ?>
" />
						<input type="hidden" id="mailaddress" name="mailaddress" value="<?php 
                echo html_encode($mailaddress);
                ?>
" />
						<input type="submit" value="<?php 
                echo gettext("Confirm");
                ?>
" />
					</form>
					<form id="discard" action="<?php 
                echo sanitize($_SERVER['REQUEST_URI']);
                ?>
" method="post" accept-charset="UTF-8">
						<input type="hidden" id="discard" name="discard" value="discard" />
						<input type="submit" value="<?php 
                echo gettext("Discard");
                ?>
" />
					</form>
				</div>
				<?php 
                return;
            } else {
                // simulate confirmation action
                $_POST['confirm'] = true;
                $_POST['subject'] = $subject;
                $_POST['message'] = $message;
                $_POST['mailaddress'] = $mailaddress;
                $_POST['name'] = $name;
            }
        }
    }
    if (isset($_POST['confirm'])) {
        $subject = sanitize($_POST['subject']);
        $message = sanitize($_POST['message'], 1);
        $mailaddress = sanitize($_POST['mailaddress']);
        $name = sanitize($_POST['name']);
        $contactform_mailinglist = getOption("contactform_mailaddress");
        $mailinglist = explode(';', $contactform_mailinglist);
        if (getOption('contactform_sendcopy')) {
            $sendcopy = array($name => $mailaddress);
        } else {
            $sendcopy = NULL;
        }
        $err_msg = zp_mail($subject, $message, $mailinglist, $sendcopy);
        if ($err_msg) {
            $msgs = explode('.', $err_msg);
            unset($msgs[0]);
            //	the "mail send failed" text
            unset($msgs[count($msgs)]);
            //	a trailing empty one
            ?>
			<div class="errorbox">
				<strong><?php 
            echo ngettext('Error sending mail:', 'Errors sending mail:', count($msgs));
            ?>
</strong>
				<ul class="errorlist">
					<?php 
            foreach ($msgs as $line) {
                echo '<li>' . trim($line) . '</li>';
            }
            ?>
				</ul>
			</div>
			<?php 
        } else {
            echo get_language_string(getOption("contactform_thankstext"));
        }
        echo '<p><a href="?again">' . get_language_string(getOption('contactform_newmessagelink')) . '</a></p>';
    } else {
        if (count($error) <= 0) {
            if (zp_loggedin()) {
                $mailcontent = array('title' => '', 'name' => $_zp_current_admin_obj->getName(), 'company' => '', 'street' => '', 'city' => '', 'state' => '', 'country' => '', 'postal' => '', 'email' => $_zp_current_admin_obj->getEmail(), 'website' => '', 'phone' => '', 'subject' => $subject_override, 'message' => '');
                if (getOption('zp_plugin_comment_form')) {
                    $raw = $_zp_current_admin_obj->getCustomData();
                    if (preg_match('/^a:[0-9]+:{/', $raw)) {
                        $address = unserialize($raw);
                        foreach ($address as $key => $field) {
                            $mailcontent[$key] = $field;
                        }
                    }
                }
            } else {
                $mailcontent = array('title' => '', 'name' => '', 'company' => '', 'street' => '', 'city' => '', 'state' => '', 'country' => '', 'email' => '', 'postal' => '', 'website' => '', 'phone' => '', 'subject' => $subject_override, 'message' => '');
            }
        }
        echo get_language_string(getOption("contactform_introtext"));
        if (getOption('contactform_sendcopy')) {
            echo get_language_string(getOption("contactform_sendcopy_text"));
        }
        $_processing_post = false;
        include getPlugin('contact_form/form.php', true);
    }
}
Exemple #8
0
 /**
  * Gets the feed item data in a comments feed
  *
  * @param array $item Array of a comment
  * @return array
  */
 protected function getitemComments($item)
 {
     if ($item['anon']) {
         $author = "";
     } else {
         $author = " " . gettext("by") . " " . $item['name'];
     }
     $commentpath = $imagetag = $title = '';
     switch ($item['type']) {
         case 'images':
             $title = get_language_string($item['title']);
             $obj = newImage(array('folder' => $item['folder'], 'filename' => $item['filename']));
             $link = $obj->getlink();
             $feeditem['pubdate'] = date("r", strtotime($item['date']));
             $category = get_language_string($item['albumtitle']);
             $website = $item['website'];
             $title = $category . ": " . $title;
             $commentpath = PROTOCOL . '://' . $this->host . $link . "#" . $item['id'];
             break;
         case 'albums':
             $obj = newAlbum($item['folder']);
             $link = rtrim($obj->getLink(), '/');
             $feeditem['pubdate'] = date("r", strtotime($item['date']));
             $title = get_language_string($item['albumtitle']);
             $website = $item['website'];
             $commentpath = PROTOCOL . '://' . $this->host . $link . "#" . $item['id'];
             break;
         case 'news':
         case 'pages':
             if (extensionEnabled('zenpage')) {
                 $feeditem['pubdate'] = date("r", strtotime($item['date']));
                 $category = '';
                 $title = get_language_string($item['title']);
                 $titlelink = $item['titlelink'];
                 $website = $item['website'];
                 if ($item['type'] == 'news') {
                     $obj = newArticle($titlelink);
                 } else {
                     $obj = newPage($titlelink);
                 }
                 $commentpath = PROTOCOL . '://' . $this->host . html_encode($obj->getLink()) . "#" . $item['id'];
             } else {
                 $commentpath = '';
             }
             break;
     }
     $feeditem['title'] = getBare($title . $author);
     $feeditem['link'] = $commentpath;
     $feeditem['desc'] = $item['comment'];
     return $feeditem;
 }
Exemple #9
0
$args = getImageArgs($_GET);
$args[0] = 'FULL';
$adminrequest = $args[12];
if ($forbidden = getOption('image_processor_flooding_protection') && (!isset($_GET['check']) || $_GET['check'] != sha1(HASH_SEED . serialize($args)))) {
    // maybe it was from the tinyZenpage javascript which does not know better!
    zp_session_start();
    $forbidden = !isset($_SESSION['adminRequest']) || $_SESSION['adminRequest'] != @$_COOKIE['zp_user_auth'];
}
$args[0] = 'FULL';
$hash = getOption('protected_image_password');
if (($hash || !$albumobj->checkAccess()) && !zp_loggedin(VIEW_FULLIMAGE_RIGHTS)) {
    //	handle password form if posted
    zp_handle_password('zp_image_auth', getOption('protected_image_password'), getOption('protected_image_user'));
    //check for passwords
    $authType = 'zp_image_auth';
    $hint = get_language_string(getOption('protected_image_hint'));
    $show = getOption('protected_image_user');
    if (empty($hash)) {
        // check for album password
        $hash = $albumobj->getPassword();
        $authType = "zp_album_auth_" . $albumobj->getID();
        $hint = $albumobj->getPasswordHint();
        $show = $albumobj->getUser();
        if (empty($hash)) {
            $albumobj = $albumobj->getParent();
            while (!is_null($albumobj)) {
                $hash = $albumobj->getPassword();
                $authType = "zp_album_auth_" . $albumobj->getID();
                $hint = $albumobj->getPasswordHint();
                $show = $albumobj->getUser();
                if (!empty($hash)) {
/**
 * Updates a category
 *
 */
function updateCategory(&$reports)
{
    $date = date('Y-m-d_H-i-s');
    $id = sanitize_numeric($_POST['id']);
    $permalink = getcheckboxState('permalink');
    $title = process_language_string_save("title", 2);
    $desc = process_language_string_save("desc", 0);
    $custom = process_language_string_save("custom_data", 1);
    $titlelink = $oldtitlelink = sanitize($_POST['titlelink-old'], 3);
    if (getcheckboxState('edittitlelink')) {
        $titlelink = sanitize($_POST['titlelink'], 3);
        if (empty($titlelink)) {
            $titlelink = seoFriendly(get_language_string($title));
            if (empty($titlelink)) {
                $titlelink = seoFriendly($date);
            }
        }
    } else {
        if (!$permalink) {
            //	allow the link to change
            $link = seoFriendly(get_language_string($title));
            if (!empty($link)) {
                $titlelink = $link;
            }
        }
    }
    $titleok = true;
    if ($titlelink != $oldtitlelink) {
        // title link change must be reflected in DB before any other updates
        $titleok = query('UPDATE ' . prefix('news_categories') . ' SET `titlelink`=' . db_quote($titlelink) . ' WHERE `id`=' . $id, false);
        if (!$titleok) {
            $titlelink = $oldtitlelink;
            // force old link so data gets saved
        }
    } else {
        $titlelink = $oldtitlelink;
    }
    //update category
    $show = getcheckboxState('show');
    $cat = new ZenpageCategory($titlelink);
    $notice = processPasswordSave($cat);
    $cat->setPermalink(getcheckboxState('permalink'));
    $cat->set('title', $title);
    $cat->setDesc($desc);
    $cat->setCustomData(zp_apply_filter('save_category_custom_data', $custom, $cat));
    $cat->setShow($show);
    if (getcheckboxState('resethitcounter')) {
        $cat->set('hitcounter', 0);
    }
    $msg = zp_apply_filter('update_category', '', $cat, $oldtitlelink);
    $cat->save();
    if ($titleok) {
        if (empty($titlelink) or empty($title)) {
            $reports[] = "<p class='errorbox fade-message'>" . gettext("You forgot to give your category a <strong>title or titlelink</strong>!") . "</p>";
        } else {
            if ($notice == 'user') {
                $reports[] = "<p class='errorbox fade-message'>" . gettext('You must supply a password for the Protected Category user') . '</p>';
            } else {
                if ($notice == 'pass') {
                    $reports[] = "<p class='errorbox fade-message'>" . gettext('Your passwords were empty or did not match') . '</p>';
                } else {
                    $reports[] = "<p class='messagebox fade-message'>" . gettext("Category updated!") . "</p>";
                }
            }
        }
    } else {
        $reports[] = "<p class='errorbox fade-message'>" . sprintf(gettext("A category with the title/titlelink <em>%s</em> already exists!"), html_encode($cat->getTitle())) . "</p>";
    }
    if ($msg) {
        $reports[] = $msg;
    }
    return $cat;
}
            $flag = array();
        }
        printManagedObjects('albums', $albumlist, $album_alter_rights, $userobj, $id, gettext('user'), $flag);
        if (extensionEnabled('zenpage')) {
            $pagelist = array();
            $pages = $_zp_zenpage->getPages(false);
            foreach ($pages as $page) {
                if (!$page['parentid']) {
                    $pagelist[get_language_string($page['title'])] = $page['titlelink'];
                }
            }
            printManagedObjects('pages', $pagelist, $album_alter_rights, $userobj, $id, gettext('user'), NULL);
            $newslist = array();
            $categories = $_zp_zenpage->getAllCategories(false);
            foreach ($categories as $category) {
                $newslist[get_language_string($category['title'])] = $category['titlelink'];
            }
            printManagedObjects('news', $newslist, $album_alter_rights, $userobj, $id, gettext('user'), NULL);
        }
    }
    ?>
												</td>
											</tr>
											<?php 
    echo $custom_row;
    ?>
										</table> <!-- end individual admin table -->
									</td>
								</tr>
								<?php 
    $id++;
Exemple #12
0
// custom menu check end
?>

<?php 
if (extensionEnabled('zenpage')) {
    ?>
	<div class="menu">
		<h3><?php 
    echo gettext("Latest notes");
    ?>
</h3>
		<ul>
			<?php 
    $latest = getLatestNews(3);
    foreach ($latest as $item) {
        $title = htmlspecialchars(get_language_string($item['title']));
        $link = getNewsURL($item['titlelink']);
        echo "<li><a href=\"" . $link . "\" title=\"" . strip_tags(htmlspecialchars($title, ENT_QUOTES)) . "\">" . htmlspecialchars($title) . "</a></li>";
    }
    ?>
		</ul>
	</div>
<?php 
}
?>

<div class="menu">
	<h3><?php 
echo gettext("Toolbox");
?>
</h3>
Exemple #13
0
        /**
         * Prints links to the favorites "albums"
         *
         * @global favorites $_myFavorites
         * @param type $text
         */
        function printFavoritesURL($text = NULL, $before = NULL, $between = NULL, $after = NULL)
        {
            global $_myFavorites;
            if (zp_loggedin()) {
                if (is_null($text)) {
                    $text = get_language_string(getOption('favorites_linktext'));
                }
                $list = $_myFavorites->getList();
                $betwixt = NULL;
                echo $before;
                foreach ($_myFavorites->getList() as $instance) {
                    $link = $_myFavorites->getLink(NULL, $instance);
                    $display = $text;
                    if ($instance) {
                        $display .= '[' . $instance . ']';
                    }
                    echo $betwixt;
                    $betwixt = $between;
                    ?>
					<a href="<?php 
                    echo $link;
                    ?>
" class="favorite_link"><?php 
                    echo html_encode($display);
                    ?>
 </a>
					<?php 
                }
                echo $after;
            }
        }
Exemple #14
0
/**
 * Prints the footer
 */
function jqm_printFooterNav()
{
    global $_zp_gallery_page, $_zp_current_album;
    ?>
	<div id="footer" data-role="footer">
		<?php 
    @call_user_func('printLanguageSelector', "langselector");
    ?>
		<ul id="footerlist">
			<li><?php 
    echo gettext('Powered by');
    ?>
 <a href="http://www.zenphoto.org">Zenphoto</a> and <a href="http://jquerymobile.com">jQueryMobile</a></li>
			<li><?php 
    echo gettext('zpMobile theme by');
    ?>
 <a href="http://www.maltem.de">Malte Müller</a></li>
		</ul>
		<?php 
    $adminlink = '';
    $favoriteslink = '';
    if (!zp_loggedin() && function_exists('printRegisterURL')) {
        if ($_zp_gallery_page != 'register.php') {
            $_linktext = get_language_string(getOption('register_user_page_link'));
            $adminlink = '<li><a rel="external" href="' . html_encode(register_user::getLink()) . '">' . $_linktext . '</a></li>';
        }
    }
    if (function_exists('printFavoritesURL')) {
        $favoriteslink = '<li><a rel="external" href="' . html_encode(getFavoritesURL()) . '">' . gettext('Favorites') . '</a></li>';
    }
    if ($adminlink || $favoriteslink) {
        ?>
			<div data-role="navbar">
				<ul id="footernav">
					<?php 
        echo $adminlink . $favoriteslink;
        if (function_exists("printUserLogin_out")) {
            echo "<li>";
            printUserLogin_out("", "", 0);
            echo "</li>";
        }
        ?>
				</ul>
			</div>
			<!-- /navbar -->
	<?php 
    }
    ?>
	</div><!-- footer -->
	<?php 
}
Exemple #15
0
         header("Status: 403 " . gettext("Forbidden"));
         exitZP();
         //	terminate the script with no output
     }
 }
 $hash = getOption('downloadList_password');
 if (GALLERY_SECURITY != 'public' || $hash) {
     //	credentials required to download
     if (!zp_loggedin(getOption('downloadList_rights') ? FILES_RIGHTS : ALL_RIGHTS)) {
         $user = getOption('downloadList_user');
         zp_handle_password('download_auth', $hash, $user);
         if (!empty($hash) && zp_getCookie('download_auth') != $hash) {
             $show = $user ? true : NULL;
             $hint = '';
             if (!empty($hash)) {
                 $hint = get_language_string(getOption('downloadList_hint'));
             }
             if (isset($_GET['albumzip'])) {
                 $item .= '&albumzip';
             }
             printPasswordForm($hint, true, $show, '?download=' . $item);
             exitZP();
         }
     }
 }
 if (isset($_GET['albumzip'])) {
     DownloadList::updateListItemCount($item . '.zip');
     require_once SERVERPATH . '/' . ZENFOLDER . '/lib-zipStream.php';
     if (isset($_GET['fromcache'])) {
         $fromcache = sanitize($isset($_GET['fromcache']));
     } else {
 /**
  * Returns the password hint
  *
  * @return string
  */
 function getPasswordHint()
 {
     return get_language_string($this->get('password_hint'));
 }
Exemple #17
0
/**
 * multidimensional array column sort
 *
 * @param array $array The multidimensional array to be sorted
 * @param mixed $index Which key(s) should be sorted by
 * @param string $order true for descending sorts
 * @param bool $natsort If natural order should be used
 * @param bool $case_sensitive If the sort should be case sensitive
 * @return array
 *
 * @author redoc (http://codingforums.com/showthread.php?t=71904)
 */
function sortMultiArray($array, $index, $descending = false, $natsort = true, $case_sensitive = false, $preservekeys = false, $remove_criteria = array())
{
    if (is_array($array) && count($array) > 0) {
        if (is_array($index)) {
            $indicies = $index;
        } else {
            $indicies = array($index);
        }
        if ($descending) {
            $separator = '~~';
        } else {
            $separator = '  ';
        }
        foreach ($array as $key => $row) {
            $temp[$key] = '';
            foreach ($indicies as $index) {
                if (is_array($row) && array_key_exists($index, $row)) {
                    $temp[$key] .= get_language_string($row[$index]) . $separator;
                    if (in_array($index, $remove_criteria)) {
                        unset($array[$key][$index]);
                    }
                }
            }
            $temp[$key] .= $key;
        }
        if ($natsort) {
            if ($case_sensitive) {
                natsort($temp);
            } else {
                natcasesort($temp);
            }
            if ($descending) {
                $temp = array_reverse($temp, TRUE);
            }
        } else {
            if ($descending) {
                arsort($temp);
            } else {
                asort($temp);
            }
        }
        foreach (array_keys($temp) as $key) {
            if (!$preservekeys && is_numeric($key)) {
                $sorted[] = $array[$key];
            } else {
                $sorted[$key] = $array[$key];
            }
        }
        return $sorted;
    }
    return $array;
}
/**
 * Prints a table with a bar graph of the values.
 *
 * @param string $sortorder "popular", "mostrated","toprated","mostcommented" or - only if $type = "albums"! - "mostimages"
 * @param string_type $type "albums", "images", "pages", "news", "tags"
 * @param int $limit Number of entries to show
 */
function printBarGraph($sortorder = "mostimages", $type = "albums", $from_number = 0, $to_number = 10)
{
    global $gallery, $webpath;
    $limit = $from_number . "," . $to_number;
    $bargraphmaxsize = 400;
    switch ($type) {
        case "albums":
            $typename = gettext("Albums");
            $dbquery = "SELECT * FROM " . prefix('albums');
            break;
        case "images":
            $typename = gettext("Images");
            $dbquery = "SELECT * FROM " . prefix('images');
            break;
        case "pages":
            $typename = gettext("Pages");
            $dbquery = "SELECT * FROM " . prefix('pages');
            break;
        case "news":
            $typename = gettext("News Articles");
            $dbquery = "SELECT * FROM " . prefix('news');
            break;
        case "newscategories":
            $typename = gettext("News Categories");
            $dbquery = "SELECT * FROM " . prefix('news_categories');
            break;
        case "tags":
            $typename = gettext("Tags");
            break;
        case "rss":
            $typename = gettext("rss");
            break;
    }
    switch ($sortorder) {
        case "mostused":
            switch ($type) {
                case "tags":
                    $itemssorted = query_full_array("SELECT tagobj.tagid, count(*) as tagcount, tags.* FROM " . prefix('obj_to_tag') . " AS tagobj, " . prefix('tags') . " AS tags WHERE tags.id=tagobj.tagid GROUP BY tags.id ORDER BY tagcount DESC LIMIT " . $limit);
                    if (empty($itemssorted)) {
                        $maxvalue = 0;
                    } else {
                        $maxvalue = $itemssorted[0]['tagcount'];
                    }
                    break;
                case "newscategories":
                    $itemssorted = query_full_array("SELECT news2cat.cat_id, count(*) as catcount, cats.* FROM " . prefix('news2cat') . " AS news2cat, " . prefix('news_categories') . " AS cats WHERE cats.id=news2cat.cat_id GROUP BY news2cat.cat_id ORDER BY catcount DESC LIMIT " . $limit);
                    if (empty($itemssorted)) {
                        $maxvalue = 0;
                    } else {
                        $maxvalue = $itemssorted[0]['catcount'];
                    }
                    break;
            }
            $headline = $typename . " - " . gettext("most used");
            break;
        case "popular":
            switch ($type) {
                case 'rss':
                    $itemssorted = query_full_array("SELECT `type`,`aux`, `data` FROM " . prefix('plugin_storage') . " WHERE `type` = 'rsshitcounter' ORDER BY CONVERT(data,UNSIGNED) DESC LIMIT " . $limit);
                    if (empty($itemssorted)) {
                        $maxvalue = 0;
                    } else {
                        $maxvalue = $itemssorted[0]['data'];
                    }
                    break;
                default:
                    $itemssorted = query_full_array($dbquery . " ORDER BY hitcounter DESC LIMIT " . $limit);
                    if (empty($itemssorted)) {
                        $maxvalue = 0;
                    } else {
                        $maxvalue = $itemssorted[0]['hitcounter'];
                    }
                    break;
            }
            $headline = $typename . " - " . gettext("most viewed");
            break;
        case "mostrated":
            $itemssorted = query_full_array($dbquery . " ORDER BY total_votes DESC LIMIT " . $limit);
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                $maxvalue = $itemssorted[0]['total_votes'];
            }
            $headline = $typename . " - " . gettext("most rated");
            break;
        case "toprated":
            $itemssorted = query_full_array($dbquery . " ORDER BY (total_value/total_votes) DESC LIMIT {$limit}");
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                if ($itemssorted[0]['total_votes'] != 0) {
                    $maxvalue = $itemssorted[0]['total_value'] / $itemssorted[0]['total_votes'];
                } else {
                    $maxvalue = 0;
                }
            }
            $headline = $typename . " - " . gettext("top rated");
            break;
        case "mostcommented":
            switch ($type) {
                case "albums":
                    $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, albums.* FROM " . prefix('comments') . " AS comments, " . prefix('albums') . " AS albums WHERE albums.id=comments.ownerid AND type = 'albums' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit);
                    break;
                case "images":
                    $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, images.* FROM " . prefix('comments') . " AS comments, " . prefix('images') . " AS images WHERE images.id=comments.ownerid AND type = 'images' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit);
                    break;
                case "pages":
                    $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, pages.* FROM " . prefix('comments') . " AS comments, " . prefix('pages') . " AS pages WHERE pages.id=comments.ownerid AND type = 'page' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit);
                    break;
                case "news":
                    $itemssorted = query_full_array("SELECT comments.ownerid, count(*) as commentcount, news.* FROM " . prefix('comments') . " AS comments, " . prefix('news') . " AS news WHERE news.id=comments.ownerid AND type = 'news' GROUP BY comments.ownerid ORDER BY commentcount DESC LIMIT " . $limit);
                    break;
            }
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                $maxvalue = $itemssorted[0]['commentcount'];
            }
            $headline = $typename . " - " . gettext("most commented");
            break;
        case "mostimages":
            $itemssorted = query_full_array("SELECT images.albumid, count(*) as imagenumber, albums.* FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums WHERE albums.id=images.albumid GROUP BY images.albumid ORDER BY imagenumber DESC LIMIT " . $limit);
            if (empty($itemssorted)) {
                $maxvalue = 0;
            } else {
                $maxvalue = $itemssorted[0]['imagenumber'];
            }
            $headline = $typename . " - " . gettext("most images");
            break;
        case "latest":
            switch ($type) {
                case "albums":
                    $allalbums = query_full_array($dbquery . " ORDER BY id DESC LIMIT " . $limit);
                    $albums = array();
                    foreach ($allalbums as $album) {
                        $albumobj = new Album($gallery, $album['folder']);
                        $albumentry = array("id" => $albumobj->get('id'), "title" => $albumobj->getTitle(), "folder" => $albumobj->name, "imagenumber" => $albumobj->getNumImages(), "show" => $albumobj->get("show"));
                        array_unshift($albums, $albumentry);
                    }
                    $maxvalue = 1;
                    $itemssorted = sortMultiArray($albums, 'id', true, true);
                    // The items are originally sorted by id;
                    $headline = $typename . " - " . gettext("latest");
                    break;
                case "images":
                    $itemssorted = query_full_array($dbquery . " ORDER BY id DESC LIMIT " . $limit);
                    $barsize = 0;
                    $maxvalue = 1;
                    $headline = $typename . " - " . gettext("latest");
                    break;
            }
            break;
        case "latestupdated":
            $albums = getAlbumStatistic($to_number, 'latestupdated', '');
            $maxvalue = 1;
            if (!empty($albums)) {
                foreach ($albums as $key => $album) {
                    $albumobj = new Album($gallery, $album['folder']);
                    $albums[$key]['imagenumber'] = $albumobj->getNumImages();
                }
            }
            $itemssorted = $albums;
            $headline = $typename . " - " . gettext("latest updated");
            break;
    }
    if ($maxvalue == 0 || empty($itemssorted)) {
        $maxvalue = 1;
        $no_hitcount_enabled_msg = '';
        if ($sortorder == 'popular' && $type != 'rss' && !getOption('zp_plugin_hitcounter')) {
            $no_hitcount_enabled_msg = gettext("(The hitcounter plugin is not enabled.)");
        }
        $no_statistic_message = "<tr><td><em>" . gettext("No statistic available.") . $no_hitcount_enabled_msg . "</em></td><td></td><td></td><td></td></tr>";
    } else {
        $no_statistic_message = "";
        if ($sortorder == 'popular' && $type != 'rss' && !getOption('zp_plugin_hitcounter')) {
            $no_statistic_message = "<tr><td colspan='4'><em>" . gettext("Note: The hitcounter plugin is not enabled, therefore any existing values will not get updated.") . "</em></td><td></td><td></td><td></td></tr>";
        }
    }
    if ($from_number <= 1) {
        $count = 1;
    } else {
        $count = $from_number;
    }
    $countlines = 0;
    echo "<table class='bordered'>";
    echo "<tr><th colspan='4'><strong>" . $headline . "</strong>";
    if (isset($_GET['stats'])) {
        echo "<a href='gallery_statistics.php'> | " . gettext("Back to the top 10 lists") . "</a>";
    } else {
        if (empty($no_statistic_message)) {
            echo "<a href='gallery_statistics.php?stats=" . $sortorder . "&amp;type=" . $type . "'> | " . gettext("View more") . "</a>";
        }
        echo "<a href='#top'> | " . gettext("top") . "</a>";
    }
    echo "</th></tr>";
    echo $no_statistic_message;
    foreach ($itemssorted as $item) {
        if (array_key_exists("filename", $item)) {
            $name = $item['filename'];
        } else {
            if (array_key_exists("folder", $item)) {
                $name = $item['folder'];
            } else {
                if ($type === "pages" or $type === "news") {
                    $name = $item['titlelink'];
                } else {
                    if ($type === "newscategories") {
                        $name = $item['title'];
                    } else {
                        if ($type === "tags") {
                            $name = "";
                        }
                    }
                }
            }
        }
        switch ($sortorder) {
            case "popular":
                switch ($type) {
                    case 'rss':
                        $barsize = round($item['data'] / $maxvalue * $bargraphmaxsize);
                        $value = $item['data'];
                        break;
                    default:
                        $barsize = round($item['hitcounter'] / $maxvalue * $bargraphmaxsize);
                        $value = $item['hitcounter'];
                        break;
                }
                break;
            case "mostrated":
                if ($item['total_votes'] != 0) {
                    $barsize = round($item['total_votes'] / $maxvalue * $bargraphmaxsize);
                } else {
                    $barsize = 0;
                }
                $value = $item['total_votes'];
                break;
            case "toprated":
                if ($item['total_votes'] != 0) {
                    $barsize = round($item['total_value'] / $item['total_votes'] / $maxvalue * $bargraphmaxsize);
                    $value = round($item['total_value'] / $item['total_votes']);
                } else {
                    $barsize = 0;
                    $value = 0;
                }
                break;
            case "mostcommented":
                if ($maxvalue != 0) {
                    $barsize = round($item['commentcount'] / $maxvalue * $bargraphmaxsize);
                } else {
                    $barsize = 0;
                }
                $value = $item['commentcount'];
                break;
            case "mostimages":
                $barsize = round($item['imagenumber'] / $maxvalue * $bargraphmaxsize);
                $value = $item['imagenumber'];
                break;
            case "latest":
                switch ($type) {
                    case "albums":
                        $barsize = 0;
                        //round($item['imagenumber'] / $maxvalue * $bargraphmaxsize);
                        $value = sprintf(gettext("%s images"), $item['imagenumber']);
                        break;
                    case "images":
                        $barsize = 0;
                        $value = "";
                        break;
                }
                break;
            case "latestupdated":
                $barsize = 0;
                //round($item['imagenumber'] / $maxvalue * $bargraphmaxsize);
                $value = sprintf(gettext("%s images"), $item['imagenumber']);
                break;
            case "mostused":
                switch ($type) {
                    case "tags":
                        if ($maxvalue != 0) {
                            $barsize = round($item['tagcount'] / $maxvalue * $bargraphmaxsize);
                        } else {
                            $barsize = 0;
                        }
                        $value = $item['tagcount'];
                        break;
                    case "newscategories":
                        if ($maxvalue != 0) {
                            $barsize = round($item['catcount'] / $maxvalue * $bargraphmaxsize);
                        } else {
                            $barsize = 0;
                        }
                        $value = $item['catcount'];
                        break;
                }
                break;
        }
        // counter to have a gray background of every second line
        if ($countlines === 1) {
            $style = " style='background-color: #f4f4f4'";
            // a little ugly but the already attached class for the table is so easiest overriden...
            $countlines = 0;
        } else {
            $style = "";
            $countlines++;
        }
        switch ($type) {
            case "albums":
                $editurl = $webpath . "/admin-edit.php?page=edit&amp;album=" . $name;
                $viewurl = WEBPATH . "/index.php?album=" . $name;
                $title = get_language_string($item['title']);
                break;
            case "images":
                $getalbumfolder = query_single_row("SELECT title, folder, `show` from " . prefix("albums") . " WHERE id = " . $item['albumid']);
                if ($sortorder === "latest") {
                    $value = "<span";
                    if ($getalbumfolder['show'] != "1") {
                        $value = $value . " class='unpublished_item'";
                    }
                    $value = $value . ">" . get_language_string($getalbumfolder['title']) . "</span> (" . $getalbumfolder['folder'] . ")";
                }
                $editurl = $webpath . "/admin-edit.php?page=edit&amp;album=" . $getalbumfolder['folder'] . "&amp;image=" . $item['filename'] . "&amp;tab=imageinfo#IT";
                $viewurl = WEBPATH . "/index.php?album=" . $getalbumfolder['folder'] . "&amp;image=" . $name;
                $title = get_language_string($item['title']);
                break;
            case "pages":
                $editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?page&amp;titlelink=" . $name;
                $viewurl = WEBPATH . "/index.php?p=pages&amp;title=" . $name;
                $title = get_language_string($item['title']);
                break;
            case "news":
                $editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?news&amp;titlelink=" . $name;
                $viewurl = WEBPATH . "/index.php?p=news&amp;title=" . $name;
                $title = get_language_string($item['title']);
                break;
            case "newscategories":
                $editurl = $webpath . '/' . PLUGIN_FOLDER . "/zenpage/admin-categories.php?edit&amp;id=" . $item['id'];
                $viewurl = WEBPATH . "/index.php?p=news&amp;category=" . $name;
                $title = get_language_string($item['titlelink']);
                break;
            case "tags":
                $editurl = $webpath . "/admin-tags.php";
                $viewurl = WEBPATH . "/index.php?p=search&amp;searchfields=tags&amp;words=" . $item['name'];
                $title = get_language_string($item['name']);
                break;
            case "rss":
                $editurl = '';
                $viewurl = WEBPATH . "/index.php?" . html_encode(strrchr($item['aux'], 'rss'));
                $title = html_encode(strrchr($item['aux'], 'rss'));
                break;
        }
        if (isset($item['show'])) {
            if ($item['show'] != "1") {
                $show = " class='unpublished_item'";
            } else {
                $show = "";
            }
        } else {
            $show = "";
        }
        if ($value != 0 or $sortorder === "latest") {
            if (empty($name)) {
                $name = "";
            } else {
                $name = "(" . $name . ")";
            }
            ?>
		<tr class="statistic_wrapper">
		<td class="statistic_counter" <?php 
            echo $style;
            ?>
>
		<?php 
            echo $count;
            ?>
		</td>
		<td class="statistic_title" <?php 
            echo $style;
            ?>
>
		<strong<?php 
            echo $show;
            ?>
><?php 
            echo $title;
            ?>
</strong> <?php 
            echo $name;
            ?>
		</td>
		<td class="statistic_graphwrap" <?php 
            echo $style;
            ?>
>
		<div class="statistic_bargraph" style="width: <?php 
            echo $barsize;
            ?>
px"></div>
		<div class="statistic_value"><?php 
            echo $value;
            ?>
</div>
		</td>
		<td class="statistic_link" <?php 
            echo $style;
            ?>
>
		<?php 
            switch ($type) {
                case 'rss':
                    echo "<a href='" . $viewurl . "' title='" . $name . "'>" . gettext("View") . "</a></td>";
                    break;
                default:
                    echo "<a href='" . $editurl . "' title='" . $name . "'>" . gettext("Edit") . "</a> | <a href='" . $viewurl . "' title='" . $name . "'>" . gettext("View") . "</a></td>";
                    break;
            }
            echo "</tr>";
            $count++;
            if ($count === $limit) {
                break;
            }
        }
    }
    // foreach end
    echo "</table>";
}
Exemple #19
0
function printLogo()
{
    global $_zp_themeroot;
    if ($img = getOption('Graphic_logo')) {
        $fullimg = '/' . UPLOAD_FOLDER . '/images/' . $img . '.png';
        if (file_exists(SERVERPATH . $fullimg)) {
            echo '<img src="' . html_encode(pathurlencode(WEBPATH . $fullimg)) . '" alt="Logo"/>';
        } else {
            echo '<img src="' . $_zp_themeroot . '/images/effervescence.png" alt="Logo"/>';
        }
    } else {
        $name = get_language_string(getOption('Theme_logo'));
        if (empty($name)) {
            $name = sanitize($_SERVER['HTTP_HOST']);
        }
        echo "<h1><a>{$name}</a></h1>";
    }
}
Exemple #20
0
 function handleOption($option, $currentValue)
 {
     if ($option == 'css_style') {
         echo '<select style="width: 200px;" id="' . $option . '" name="' . $option . '"' . ">\n";
         echo '<option value="dark"';
         if ($currentValue == 'dark') {
             echo ' selected="selected">Dark</option>\\n';
         } else {
             echo '>Dark</option>\\n';
         }
         echo '<option value="light"';
         if ($currentValue == 'light') {
             echo ' selected="selected">Light</option>\\n';
         } else {
             echo '>Light</option>\\n';
         }
         echo "</select>\n";
     }
     if ($option == 'color_style') {
         echo '<select style="width: 200px;" id="' . $option . '" name="' . $option . '"' . ">\n";
         echo '<option value="default"';
         if ($currentValue == 'default') {
             echo ' selected="selected">Default</option>\\n';
         } else {
             echo '>Default</option>\\n';
         }
         echo '<option value="custom"';
         if ($currentValue == 'custom') {
             echo ' selected="selected">Custom</option>\\n';
         } else {
             echo '>Custom</option>\\n';
         }
         echo "</select>\n";
     }
     if ($option == 'zenpage_homepage') {
         $unpublishedpages = query_full_array("SELECT titlelink, title FROM " . prefix('pages') . " WHERE `show` != 1 ORDER by `sort_order`");
         if (empty($unpublishedpages)) {
             echo gettext("No unpublished pages available");
             // clear option if no unpublished pages are available or have been published meanwhile
             // so that the normal gallery index appears and no page is accidentally set if set to unpublished again.
             setThemeOption('zenpage_homepage', 'none', NULL, 'zpArdoise');
         } else {
             echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'selector-zenpage_homepage" value=0 />' . "\n";
             echo '<select id="' . $option . '" name="' . $option . '">' . "\n";
             echo '<option value="none"';
             if ($currentValue == 'none') {
                 echo ' selected="selected">' . gettext("none") . '</option>\\n';
             } else {
                 echo '>' . gettext("none") . '</option>\\n';
             }
             foreach ($unpublishedpages as $page) {
                 if ($currentValue == $page["titlelink"]) {
                     $selected = ' selected="selected"';
                 } else {
                     $selected = '';
                 }
                 echo '<option value="' . $page["titlelink"] . '"' . $selected . '>' . get_language_string($page["title"]) . '</option>';
             }
             echo "</select>\n";
         }
     }
     if ($option == 'image_statistic') {
         echo '<select style="width: 200px;" id="' . $option . '" name="' . $option . '"' . ">\n";
         echo '<option value="none"';
         if ($currentValue == 'none') {
             echo ' selected="selected">None</option>\\n';
         } else {
             echo '>None</option>\\n';
         }
         echo '<option value="random"';
         if ($currentValue == 'random') {
             echo ' selected="selected">Random</option>\\n';
         } else {
             echo '>Random</option>\\n';
         }
         echo '<option value="popular"';
         if ($currentValue == 'popular') {
             echo ' selected="selected">Popular</option>\\n';
         } else {
             echo '>Popular</option>\\n';
         }
         echo '<option value="latest"';
         if ($currentValue == 'latest') {
             echo ' selected="selected">Latest</option>\\n';
         } else {
             echo '>Latest</option>\\n';
         }
         echo '<option value="latest-date"';
         if ($currentValue == 'latest-date') {
             echo ' selected="selected">Latest-date</option>\\n';
         } else {
             echo '>Latest-date</option>\\n';
         }
         echo '<option value="latest-mtime"';
         if ($currentValue == 'latest-mtime') {
             echo ' selected="selected">Latest-mtime</option>\\n';
         } else {
             echo '>Latest-mtime</option>\\n';
         }
         echo '<option value="mostrated"';
         if ($currentValue == 'mostrated') {
             echo ' selected="selected">Most Rated</option>\\n';
         } else {
             echo '>Most Rated</option>\\n';
         }
         echo '<option value="toprated"';
         if ($currentValue == 'toprated') {
             echo ' selected="selected">Top Rated</option>\\n';
         } else {
             echo '>Top Rated</option>\\n';
         }
         echo "</select>\n";
     }
 }
 /**
  * Gets the feed item data in a Zenpage news feed
  *
  * @param array $item Titlelink a Zenpage article or filename of an image if a combined feed
  * @return array
  */
 protected function getItemNews($item)
 {
     $categories = '';
     $feeditem['enclosure'] = '';
     $obj = new ZenpageNews($item['titlelink']);
     $title = $feeditem['title'] = get_language_string($obj->getTitle('all'), $this->locale);
     $link = $obj->getLink();
     $count2 = 0;
     $plaincategories = $obj->getCategories();
     $categories = '';
     foreach ($plaincategories as $cat) {
         $catobj = new ZenpageCategory($cat['titlelink']);
         $categories .= get_language_string($catobj->getTitle('all'), $this->locale) . ', ';
     }
     $categories = rtrim($categories, ', ');
     $desc = $obj->getContent($this->locale);
     $desc = str_replace('//<![CDATA[', '', $desc);
     $desc = str_replace('//]]>', '', $desc);
     $feeditem['desc'] = shortenContent($desc, getOption('externalFeed_truncate_length'), '...');
     if (!empty($categories)) {
         $feeditem['category'] = html_encode($categories);
         $feeditem['title'] = $title . ' (' . $categories . ')';
     }
     $feeditem['link'] = $link;
     $feeditem['media_content'] = '';
     $feeditem['media_thumbnail'] = '';
     $feeditem['pubdate'] = date("r", strtotime($obj->getDateTime()));
     return $feeditem;
 }
Exemple #22
0
 /**
  * Check if an e-mail address has been provided
  * @param $updated
  * @param $userobj
  * @param $i
  * @param $alter
  */
 static function save_custom($updated, $userobj, $i, $alter)
 {
     global $_notification_sent;
     if ($userobj->getGroup() == 'federated_verify' && is_valid_email_zp($userobj->getEmail())) {
         $userobj->save();
         $admin_e = $userobj->getEmail();
         $user = $userobj->getUser();
         $key = bin2hex(serialize(array('user' => $user, 'email' => $admin_e, 'date' => time())));
         $link = FULLWEBPATH . '/index.php?verify_federated_user='******'Visit %s to validate your federated logon credentials.'), $link);
         zp_mail(get_language_string(gettext('Federated user confirmation')), $message, array($user => $admin_e));
     }
     return $updated;
 }
Exemple #23
0
 private static function checkexpires($loggedin, $userobj)
 {
     global $_zp_gallery;
     if ($userobj->logout_link !== true) {
         return $loggedin;
     }
     if (!($subscription = 86400 * getOption('user_expiry_interval'))) {
         // expiry is disabled
         return $loggedin;
     }
     $expires = strtotime($userobj->getDateTime()) + $subscription;
     if ($expires < time()) {
         $userobj->setValid(2);
         $userobj->save();
         $loggedin = false;
     } else {
         if ($expires < time() + getOption('user_expiry_warn_interval') * 86400) {
             //	expired
             if (getOption('user_expiry_auto_renew')) {
                 $newdate = getOption('user_expiry_interval') * 86400 + strtotime($userobj->getDateTime());
                 if ($newdate + getOption('user_expiry_interval') * 86400 < time()) {
                     $newdate = time() + getOption('user_expiry_interval') * 86400;
                 }
                 $userobj->setDateTime(date('Y-m-d H:i:s', $newdate));
                 $userobj->setValid(1);
                 $credentials = $userobj->getCredentials();
                 $key = array_search('exiry_notice', $credentials);
                 if ($key !== false) {
                     unset($credentials[$key]);
                     $userobj->setCredentials($credentials);
                 }
                 $userobj->save();
             } else {
                 if ($mail = $userobj->getEmail()) {
                     $credentials = $userobj->getCredentials();
                     if (!in_array('exiry_notice', $credentials)) {
                         $credentials[] = 'exiry_notice';
                         $userobj->setCredentials($credentials);
                         $userobj->save();
                         $message = sprintf(gettext('Your user id for the Zenphoto site %s will expire on %s.'), $_zp_gallery->getTitle(), date('Y-m-d', $expires));
                         $notify = zp_mail(get_language_string(gettext('User id expiration')), $message, array($userobj->getName() => $mail));
                     }
                 }
             }
         } else {
             $credentials = $userobj->getCredentials();
             $key = array_search('exiry_notice', $credentials);
             if ($key !== false) {
                 unset($credentials[$key]);
                 $userobj->setCredentials($credentials);
                 $userobj->save();
             }
         }
     }
     return $loggedin;
 }
Exemple #24
0
    $feeds = explode(';', $feeds);
    if (count($feeds) < 0) {
        exitZP();
    }
    // set the header type
    header("Content-type: text/xml");
    // set an arbitrary feed date
    $RSS_date = date("r", mktime(10, 0, 0, 9, 8, 2010));
    if (isset($_GET['lang'])) {
        $locale = sanitize($_GET['lang']);
    } else {
        $locale = getOption('locale');
    }
    $gallery = new Gallery();
    // Create new MergedRSS object with desired parameters
    $MergedRSS = new MergedRSS($feeds, getBare(get_language_string($gallery->getTitle(), $locale)), FULLWEBPATH, getBare(get_language_string($gallery->getDesc(), $locale)), $RSS_date);
    //Export the first 10 items to screen
    $mergedrss_feeditems = getOption('mergedrss_items');
    if (empty($mergedrss_feeditems)) {
        $mergedrss_feeditems = 10;
    }
    $MergedRSS->export(false, true, $mergedrss_feeditems);
    //getOption('RSS_items')
    exitZP();
}
class MergedRSSOptions
{
    function __construct()
    {
        if (OFFSET_PATH == 2) {
            setOptionDefault('mergedrss_items', 10);
Exemple #25
0
 /**
  * Returns the password hint
  *
  * @return string
  */
 function getPasswordHint($locale = NULL)
 {
     $text = $this->get('password_hint');
     if ($locale !== 'all') {
         $text = get_language_string($text, $locale);
     }
     $text = zpFunctions::unTagURLs($text);
     return $text;
 }
Exemple #26
0
                // all of the image types
                $imagedata = query_full_array("SELECT `title`, `filename`, `albumid` FROM " . prefix('images') . " WHERE `id`=" . $comment['ownerid']);
                if ($imagedata) {
                    $imgdata = $imagedata[0];
                    $image = $imgdata['filename'];
                    if ($imgdata['title'] == "") {
                        $title = $image;
                    } else {
                        $title = get_language_string($imgdata['title']);
                    }
                    $title = '/ ' . $title;
                    $albmdata = query_full_array("SELECT `folder`, `title` FROM " . prefix('albums') . " WHERE `id`=" . $imgdata['albumid']);
                    if ($albmdata) {
                        $albumdata = $albmdata[0];
                        $album = $albumdata['folder'];
                        $albumtitle = get_language_string($albumdata['title']);
                        $link = "<a href=\"" . rewrite_path("/{$album}/{$image}", "/index.php?album=" . urlencode($album) . "&amp;image=" . urlencode($image)) . "\">" . $albumtitle . $title . "</a>";
                        if (empty($albumtitle)) {
                            $albumtitle = $album;
                        }
                    }
                }
                break;
        }
        $comment = truncate_string($comment['comment'], 123);
        echo "<li><div class=\"commentmeta\">" . sprintf(gettext('<em>%1$s</em> commented on %2$s:'), $author, $link) . "</div><div class=\"commentbody\">{$comment}</div></li>";
    }
    ?>
</ul>
</div>
/**
 * Prints excerpts of the direct subpages (1 level) of a page for a kind of overview. The setup is:
 * <div class='pageexcerpt'>
 * <h4>page title</h3>
 * <p>page content excerpt</p>
 * <p>read more</p>
 * </div>
 *
 * @param int $excerptlength The length of the page content, if nothing specifically set, the plugin option value for 'news article text length' is used
 * @param string $readmore The text for the link to the full page. If empty the read more setting from the options is used.
 * @param string $shortenindicator The optional placeholder that indicates that the content is shortened, if this is not set the plugin option "news article text shorten indicator" is used.
 * @return string
 */
function printSubPagesExcerpts($excerptlength = NULL, $readmore = NULL, $shortenindicator = NULL)
{
    global $_zp_current_zenpage_page;
    if (is_null($readmore)) {
        $readmore = get_language_string(ZP_READ_MORE);
    }
    $pages = $_zp_current_zenpage_page->getPages();
    $subcount = 0;
    if (is_null($excerptlength)) {
        $excerptlength = ZP_SHORTEN_LENGTH;
    }
    foreach ($pages as $page) {
        $pageobj = new ZenpagePage($page['titlelink']);
        if ($pageobj->getParentID() == $_zp_current_zenpage_page->getID()) {
            $subcount++;
            $pagetitle = html_encode($pageobj->getTitle());
            $pagecontent = $pageobj->getContent();
            if ($pageobj->checkAccess()) {
                $pagecontent = getContentShorten($pagecontent, $excerptlength, $shortenindicator, $readmore, $pageobj->getLink());
            } else {
                $pagecontent = '<p><em>' . gettext('This page is password protected') . '</em></p>';
            }
            echo '<div class="pageexcerpt">';
            echo '<h4><a href="' . html_encode($pageobj->getLink()) . '" title="' . getBare($pagetitle) . '">' . $pagetitle . '</a></h4>';
            echo $pagecontent;
            echo '</div>';
        }
    }
}
/**
 * Helper function to get the image/video extra entries for albums if the Google video extension is enabled
 * @return string
 */
function getSitemapGoogleImageVideoExtras($albumobj, $imageobj, $locale)
{
    $data = '';
    $host = PROTOCOL . '://' . html_encode($_SERVER["HTTP_HOST"]);
    $ext = strtolower(strrchr($imageobj->filename, "."));
    $location = '';
    if ($imageobj->getLocation()) {
        $location .= $imageobj->getLocation($locale) . ', ';
    }
    if ($imageobj->getCity()) {
        $location .= $imageobj->getCity($locale) . ', ';
    }
    if ($imageobj->getState()) {
        $location .= $imageobj->getState($locale) . ', ';
    }
    if ($imageobj->getCountry()) {
        $location .= $imageobj->getCountry($locale);
    }
    $license = get_language_string(getOption('sitemap_license'), $locale);
    if (isImageVideo($imageobj) && in_array($ext, array('.mpg', '.mpeg', '.mp4', '.m4v', '.mov', '.wmv', '.asf', '.avi', '.ra', '.ram', '.flv', '.swf'))) {
        // google says it can index these so we list them even if unsupported by Zenphoto
        $data .= sitemap_echonl("\t\t<video:video>\n\t\t\t<video:thumbnail_loc>" . $host . html_encode($imageobj->getThumb()) . "</video:thumbnail_loc>\n");
        $data .= sitemap_echonl("\t\t\t<video:title>" . html_encode($imageobj->getTitle($locale)) . "</video:title>");
        if ($imageobj->getDesc()) {
            $data .= sitemap_echonl("\t\t\t<video:description>" . html_encode(getBare($imageobj->getDesc($locale))) . "</video:description>");
        }
        $data .= sitemap_echonl("\t\t\t<video:content_loc>" . $host . pathurlencode($imageobj->getFullImageURL()) . "</video:content_loc>");
        $data .= sitemap_echonl("\t\t</video:video>");
    } else {
        if (in_array($ext, array('.jpg', '.jpeg', '.gif', '.png'))) {
            // this might need to be extended!
            $data .= sitemap_echonl("\t\t<image:image>\n\t\t\t<image:loc>" . $host . html_encode($imageobj->getSizedImage(getOption('image_size'))) . "</image:loc>\n");
            // disabled for the multilingual reasons above
            $data .= sitemap_echonl("\t\t\t<image:title>" . html_encode($imageobj->getTitle($locale)) . "</image:title>");
            if ($imageobj->getDesc()) {
                $data .= sitemap_echonl("\t\t\t<image:caption>" . html_encode(getBare($imageobj->getDesc($locale))) . "</image:caption>");
            }
            if (!empty($license)) {
                $data .= sitemap_echonl("\t\t\t<image:license>" . $license . "</image:license>");
            }
            // location is kept although the same multilingual issue applies
            if (!empty($location)) {
                $data .= sitemap_echonl("\t\t\t<image:geo_location>" . $location . "</image:geo_location>");
            }
            $data .= sitemap_echonl("\t\t</image:image>");
        }
    }
    return $data;
}
Exemple #29
0
 /**
  * Returns the place data of an album
  *
  * @return string
  */
 function getLocation($locale = NULL)
 {
     $text = $this->get('location');
     if ($locale !== 'all') {
         $text = get_language_string($text, $locale);
     }
     $text = zpFunctions::unTagURLs($text);
     return $text;
 }
    static function getJS()
    {
        $message = gettext_pl('This website uses cookies. By continuing to browse the site, you agree to our use of cookies.', 'zp_cookieconsent');
        if (getOption('zpcookieconsent_message')) {
            $message = get_language_string(getOption('zpcookieconsent_message'));
        }
        $dismiss = gettext_pl('Agree', 'zp_cookieconsent');
        if (getOption('zpcookieconsent_buttonagree')) {
            $dismiss = get_language_string(getOption('zpcookieconsent_buttonagree'));
        }
        $learnmore = gettext_pl('More info', 'zp_cookieconsent');
        if (getOption('zpcookieconsent_buttonlearnmore')) {
            $learnmore = get_language_string(getOption('zpcookieconsent_buttonlearnmore'));
        }
        $link = getOption('zpcookieconsent_buttonlearnmorelink');
        $theme = '';
        if (getOption('zpcookieconsent_theme')) {
            $theme = FULLWEBPATH . '/' . USER_PLUGIN_FOLDER . '/zp_cookieconsent/styles/' . getOption('zpcookieconsent_theme') . '.css';
        }
        $domain = '';
        if (getOption('zpcookieconsent_domain')) {
            $domain = getOption('zpcookieconsent_domain');
        }
        $DoC = false;
        if (getOption('zpcookieconsent_dismissonclick')) {
            $DoC = true;
        }
        $DoS = false;
        if (getOption('zpcookieconsent_dismissonscroll') & !strpos($link, $_SERVER['REQUEST_URI'])) {
            // false in Cookie Policy Page
            $DoS = true;
        }
        ?>
		<script>
    window.cookieconsent_options = {
				message: '<?php 
        echo js_encode($message);
        ?>
',
				dismiss: '<?php 
        echo js_encode($dismiss);
        ?>
',
        learnMore: '<?php 
        echo $learnmore;
        ?>
',
				theme: '<?php 
        echo $theme;
        ?>
',
        link: '<?php 
        echo html_encode($link);
        ?>
',
				domain: '<?php 
        echo $domain;
        ?>
',
				expiryDays: <?php 
        echo getOption('zpcookieconsent_expirydays');
        ?>
    };
<?php 
        if ($DoC || $DoS) {
            // dismiss on-click or on-scroll
            if ($DoC) {
                // dismiss on-click
                ?>
			$('a').not('[href*=#]').on('click', DismissOnClick);

			function DismissOnClick() {
				var isInternalLink = new RegExp('/' + window.location.host + '/');
				if ( isInternalLink.test(this.href)) {
					fatto(0);
				}
			}
<?php 
            }
            if ($DoS) {
                // Dismiss on-scroll
                ?>
			var IniScroll, noHurry;
			$(window).load(function (){
				if(noHurry) {
					window.clearTimeout(noHurry);
				}
				noHurry = window.setTimeout(function() {
					IniScroll = $(window).scrollTop();
					$(window).on("scroll",DismissOnScroll);
				}, 500);
			});

			function DismissOnScroll() {
				var NewScroll = $(window).scrollTop();
				if (Math.abs(NewScroll - IniScroll) > <?php 
                echo getOption('zpcookieconsent_scrollrange');
                ?>
) {
					fatto(1);
				}
			}
<?php 
            }
            // Unbind and simulate dismiss button
            ?>
		function fatto (FromScroll) {
<?php 
            if ($DoC) {
                ?>
			$('a').off('click', DismissOnClick);

			if ($('.cc_btn_accept_all').length &! FromScroll) {
				$('.cc_btn_accept_all')[0].click();
			}
<?php 
            }
            if ($DoS) {
                ?>
			$(window).off("scroll", DismissOnScroll);

			if ($('.cc_btn_accept_all').length && FromScroll) {
				fadeOut(document.querySelector(".cc_banner-wrapper"));
			}
			function fadeOut(el){
				el.style.opacity = 1;
				(function fade() {
					if ((el.style.opacity -= 1/25) < 0) {
						$('.cc_btn_accept_all')[0].click();
					} else if (window.requestAnimationFrame){
						requestAnimationFrame(fade);
					} else {
						$('.cc_btn_accept_all')[0].click();
					}
				})();
			}
<?php 
            }
            ?>
		}
<?php 
        }
        ?>
		</script>
		<script src="<?php 
        echo FULLWEBPATH . '/' . USER_PLUGIN_FOLDER;
        ?>
/zp_cookieconsent/cookieconsent.min.js"></script>
		<?php 
    }