예제 #1
0
function render_tree($Pages, $groupID, $parentID = 0, $class = false)
{
    $pages = $Pages->get_by_parent($parentID, $groupID);
    $s = '';
    $s = '<ol class="' . $class . '">';
    if (PerchUtil::count($pages)) {
        foreach ($pages as $Page) {
            $s .= '<li><div class="page icon">' . PerchUtil::html($Page->pageNavText()) . '</div>';
            $s .= render_tree($Pages, $groupID, $Page->id(), $class);
            $s .= '</li>';
        }
    }
    $s .= '</ol>';
    return $s;
}
예제 #2
0
function render_tree($Categories, $Set, $parentID = 0, $class = false)
{
    $categories = $Categories->get_by_parent($parentID, $Set->id());
    $s = '';
    $s = '<ol class="' . $class . '">';
    if (PerchUtil::count($categories)) {
        foreach ($categories as $Category) {
            $s .= '<li id="category_' . $Category->id() . '" data-parent="' . $parentID . '"><div class="category icon">';
            $s .= '<input type="text" name="c-' . $Category->id() . '" value="' . $Category->catOrder() . '" />';
            $s .= '' . PerchUtil::html($Category->catTitle()) . '</div>';
            $s .= render_tree($Categories, $Set, $Category->id());
            $s .= '</li>';
        }
    }
    $s .= '</ol>';
    return $s;
}
예제 #3
0
 /**
  * Add a new key to the regions table
  *
  * @param string $key 
  * @param array $opts
  * @return void
  * @author Drew McLellan
  */
 private function _register_new_key($key, $opts = array())
 {
     if (!isset($this->registered[$key])) {
         $Perch = Perch::fetch();
         $page = $Perch->get_page();
         $data = array();
         $data['regionKey'] = $key;
         $data['regionPage'] = $page;
         $data['regionHTML'] = '<!-- Undefined content: ' . PerchUtil::html($key) . ' -->';
         $data['regionOptions'] = '';
         if (is_array($opts) && count($opts)) {
             if ($opts['page']) {
                 $data['regionPage'] = $opts['page'];
                 // Creating for a different page, so make sure old pageID cache is cleared.
                 $this->pageID = false;
             }
             if ($opts['shared']) {
                 $data['regionPage'] = '*';
             }
             if ($opts['template']) {
                 $data['regionTemplate'] = $opts['template'];
                 $data['regionNew'] = 0;
             }
             if ($opts['multiple']) {
                 $data['regionMultiple'] = 1;
             } else {
                 $data['regionMultiple'] = 0;
             }
             if ($opts['searchable']) {
                 $data['regionSearchable'] = 1;
             } else {
                 $data['regionSearchable'] = 0;
             }
             if ($opts['roles']) {
                 $data['regionEditRoles'] = $opts['roles'];
             }
             $regionOptions = array();
             if ($opts['sort']) {
                 $regionOptions['sortField'] = $opts['sort'];
             }
             if ($opts['sort-order']) {
                 $regionOptions['sortOrder'] = $opts['sort-order'];
             }
             if ($opts['edit-mode']) {
                 $regionOptions['edit_mode'] = $opts['edit-mode'];
             }
             if ($opts['search-url']) {
                 $regionOptions['searchURL'] = $opts['search-url'];
             }
             if ($opts['add-to-top']) {
                 $regionOptions['addToTop'] = $opts['add-to-top'];
             }
             if ($opts['limit']) {
                 $regionOptions['limit'] = $opts['limit'];
             }
             if ($opts['title-delimiter']) {
                 $regionOptions['title_delimit'] = $opts['title-delimiter'];
             }
             if ($opts['columns']) {
                 $regionOptions['column_ids'] = $opts['columns'];
             }
             $data['regionOptions'] = PerchUtil::json_safe_encode($regionOptions);
         }
         $data['pageID'] = $this->_find_or_create_page($data['regionPage']);
         if ($data['pageID']) {
             $db = PerchDB::fetch();
             $cols = array();
             $vals = array();
             foreach ($data as $key => $value) {
                 $cols[] = $key;
                 $vals[] = $db->pdb($value) . ' AS ' . $key;
             }
             $sql = 'INSERT INTO ' . $this->table . '(' . implode(',', $cols) . ') 
                     SELECT ' . implode(',', $vals) . ' 
                     FROM (SELECT 1) AS dtable
                     WHERE (
                             SELECT COUNT(*) 
                             FROM ' . $this->table . ' 
                             WHERE regionKey=' . $db->pdb($data['regionKey']) . ' 
                                 AND (regionPage=' . $db->pdb($data['regionPage']) . ' OR regionPage=' . $db->pdb('*') . ')
                             )=0
                     LIMIT 1';
             $db->execute($sql);
             $this->registered[$key] = true;
             $this->new_keys_registered = true;
         }
     }
 }
예제 #4
0
    <ul class="smartbar">
        <li class="<?php 
    echo $filter == 'all' ? 'selected' : '';
    ?>
"><a href="<?php 
    echo PerchUtil::html($API->app_path());
    ?>
"><?php 
    echo $Lang->get('All');
    ?>
</a></li>
        <li class="new <?php 
    echo $filter == 'status' && $status == 'draft' ? 'selected' : '';
    ?>
"><a href="<?php 
    echo PerchUtil::html($API->app_path() . '?status=draft');
    ?>
"><?php 
    echo $Lang->get('Drafts');
    ?>
</a></li>
        <?php 
    if ($filter == 'status' && $status == 'draft') {
        $Alert->set('filter', PerchLang::get('You are viewing all draft posts.') . ' <a href="' . $API->app_path() . '" class="action">' . $Lang->get('Clear Filter') . '</a>');
    }
    if (PerchUtil::count($categories)) {
        $items = array();
        foreach ($categories as $Category) {
            $items[] = array('arg' => 'category', 'val' => $Category->catPath(), 'label' => $Category->catTitle(), 'path' => $API->app_path());
        }
        echo PerchUtil::smartbar_filter('cf', 'By Category', 'Filtered by ‘%s’', $items, 'folder', $Alert, "You are viewing posts in ‘%s’", $API->app_path());
예제 #5
0
<?php

if (PerchUtil::count($app_settings)) {
    $prev_app_id = 'perch_content';
    $settings_copy = $app_settings;
    reset($settings_copy);
    foreach ($app_settings as $id => $setting) {
        if ($setting['app_id'] != $prev_app_id) {
            $app = $Perch->get_app($setting['app_id']);
            if (PerchUtil::count($app)) {
                echo '<h2 id="' . PerchUtil::html($app['id'] == 'content' ? 'perch_content' : $app['id']) . '">' . PerchUtil::html($app['label']) . '</h2>';
            }
            $API = new PerchAPI(1, $app['id']);
            $Lang = $API->get('Lang');
        }
        $c = '';
        $next_item = next($settings_copy);
        if ($next_item) {
            if ($next_item['app_id'] != $setting['app_id']) {
                $c = ' last';
            }
        }
        ?>
        <div class="field <?php 
        echo $Form->error($id, false);
        echo $c;
        ?>
">
            <?php 
        echo $Form->label($id, $app['id'] == 'content' ? PerchLang::get($setting['label']) : $Lang->get($setting['label']), false, false, false);
        ?>
예제 #6
0
        $opts[] = array('label' => $lang, 'value' => $lang);
    }
}
echo $Form->select('lang', $opts, $Form->get($settings, 'lang', 'en-gb'));
?>
            </div>
        </fieldset>

        <h2><?php 
echo PerchUtil::html(PerchLang::get('Change password'));
?>
</h2>

        <fieldset>
            <legend class="redundant"><?php 
echo PerchUtil::html(PerchLang::get('Change password'));
?>
</legend>

        <?php 
if (PERCH_PARANOID) {
    ?>
            <div class="field <?php 
    echo $Form->error('currentPassword', false);
    ?>
">
                <?php 
    echo $Form->label('currentPassword', 'Current password');
    ?>
                <?php 
    echo $Form->password('currentPassword', '');
예제 #7
0
?>
"><a href="<?php 
echo PerchUtil::html($API->app_path() . '/responses/' . '?id=' . $Form->id() . '&spam=1');
?>
"><?php 
echo $Lang->get('Spam');
?>
</a></li>
        <?php 
if ($CurrentUser->has_priv('perch_forms.configure')) {
    ?>
        <li class="<?php 
    echo $filter == 'options' ? 'selected' : '';
    ?>
"><a href="<?php 
    echo PerchUtil::html($API->app_path() . '/settings/?id=' . $Form->id());
    ?>
"><?php 
    echo $Lang->get('Form Options');
    ?>
</a></li>
        <?php 
}
?>
        <li class="fin"><a class="download icon" href="<?php 
echo $HTML->encode($API->app_path() . '/responses/export/?id=' . $Form->id());
?>
"><?php 
echo $Lang->get('Download CSV');
?>
</a></li>
예제 #8
0
		<?php 
echo PerchLang::get('Pages');
if ($CurrentUser->has_priv('content.pages.create')) {
    echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/core/apps/content/page/add/') . '" class="add button">' . PerchLang::get('Add Page') . '</a>';
}
?>
	</h2>
	<div class="bd">
		<?php 
if (PerchUtil::count($pages)) {
    echo '<ul>';
    if (PerchUtil::count($shared)) {
        echo '<li>';
        echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH) . '/core/apps/content/page/?id=-1">';
        echo PerchUtil::html(PerchLang::get('Shared'));
        echo '</a>';
        echo '</li>';
    }
    foreach ($pages as $Page) {
        echo '<li>';
        echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/core/apps/content/page/?id=' . $Page->id()) . '">';
        echo PerchUtil::html($Page->pageNavText());
        echo '</a>';
        echo '</li>';
    }
    echo '</ul>';
}
?>
	</div>

</div>
예제 #9
0
 public function get_tweet_html($tweet)
 {
     $text = trim($tweet->text);
     if ($tweet->entities) {
         // URLs
         if ($tweet->entities->urls) {
             foreach ($tweet->entities->urls as $URL) {
                 $replacement = '<a href="' . PerchUtil::html($URL->expanded_url, true) . '">' . PerchUtil::html($URL->display_url) . '</a>';
                 $text = str_replace($URL->url, $replacement, $text);
             }
         }
         // Media
         if (isset($tweet->entities->media)) {
             foreach ($tweet->entities->media as $URL) {
                 $replacement = '<a href="' . PerchUtil::html($URL->expanded_url, true) . '">' . PerchUtil::html($URL->display_url) . '</a>';
                 $text = str_replace($URL->url, $replacement, $text);
             }
         }
         // mentions
         if ($tweet->entities->user_mentions) {
             foreach ($tweet->entities->user_mentions as $Mention) {
                 $replacement = ' <a href="http://twitter.com/' . PerchUtil::html($Mention->screen_name, true) . '">@' . PerchUtil::html($Mention->screen_name) . '</a> ';
                 $text = str_replace('@' . $Mention->screen_name, $replacement, $text);
             }
         }
         // hashtags
         if ($tweet->entities->hashtags) {
             foreach ($tweet->entities->hashtags as $Hashtag) {
                 $replacement = '<a href="http://twitter.com/search?q=' . PerchUtil::html(urlencode('#' . $Hashtag->text), true) . '">#' . PerchUtil::html($Hashtag->text) . '</a>';
                 $text = str_replace('#' . $Hashtag->text, $replacement, $text);
             }
         }
     }
     return $text;
 }
예제 #10
0
파일: 2.5.php 프로젝트: Bloom-web/bloom-web
<?php

$sql = "\n\n\tALTER TABLE `__PREFIX__resources` ADD `resourceCreated` DATETIME NOT NULL DEFAULT '2000-01-01 00:00:00' AFTER `resourceType`;\n\n\tALTER TABLE `__PREFIX__resources` ADD `resourceUpdated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `resourceCreated`;\n\n    ALTER TABLE `__PREFIX__resources` ADD `resourceAWOL` TINYINT(1)  UNSIGNED  NOT NULL  DEFAULT '0'  AFTER `resourceUpdated`;\n\n    ALTER TABLE `__PREFIX__resources` ADD INDEX `idx_awol` (`resourceAWOL`);\n\n    ALTER TABLE `__PREFIX__resources` ADD `resourceTitle` CHAR(255)  NULL  DEFAULT NULL  AFTER `resourceAWOL`;\n\n    ALTER TABLE `__PREFIX__resources` ADD `resourceFileSize` INT(10)  UNSIGNED  NULL  DEFAULT NULL  AFTER `resourceTitle`;\n\n    ALTER TABLE `__PREFIX__resources` ADD `resourceWidth` INT(10)  UNSIGNED  NULL  DEFAULT NULL  AFTER `resourceFileSize`;\n\n    ALTER TABLE `__PREFIX__resources` ADD `resourceHeight` INT(10)  UNSIGNED  NULL  DEFAULT NULL  AFTER `resourceWidth`;\n\n    ALTER TABLE `__PREFIX__resources` ADD `resourceCrop` TINYINT(1)  UNSIGNED  NOT NULL  DEFAULT '0'  AFTER `resourceHeight`;\n\n    ALTER TABLE `__PREFIX__resources` ADD `resourceDensity` FLOAT  NOT NULL  DEFAULT '1'  AFTER `resourceCrop`;\n\n    ALTER TABLE `__PREFIX__resources` ADD `resourceTargetWidth` INT(10)  UNSIGNED  NULL  DEFAULT NULL  AFTER `resourceDensity`;\n\n    ALTER TABLE `__PREFIX__resources` ADD `resourceTargetHeight` INT(10)  UNSIGNED  NULL  DEFAULT NULL  AFTER `resourceTargetWidth`;\n    \n    ALTER TABLE `__PREFIX__resources` ADD `resourceMimeType` CHAR(64) NULL  DEFAULT NULL  AFTER `resourceTargetHeight`;\n\n    ALTER TABLE `__PREFIX__resources` ADD FULLTEXT INDEX `idx_search` (`resourceTitle`);\n\n    ALTER TABLE `__PREFIX__resources` ADD `resourceInLibrary` TINYINT(1)  UNSIGNED  NOT NULL  DEFAULT '0'  AFTER `resourceMimeType`;\n\n    ALTER TABLE `__PREFIX__resources` ADD INDEX `idx_library` (`resourceInLibrary`);\n\n    CREATE TABLE IF NOT EXISTS `__PREFIX__resource_tags` (\n      `tagID` INT(10) NOT NULL AUTO_INCREMENT,\n      `tagTitle` VARCHAR(255) NOT NULL DEFAULT '',\n      `tagSlug` VARCHAR(255) NOT NULL DEFAULT '',\n      `tagCount` int(10) unsigned NOT NULL DEFAULT '0',\n      PRIMARY KEY (`tagID`)\n    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;\n\n    CREATE TABLE IF NOT EXISTS `__PREFIX__resources_to_tags` (\n      `resourceID` int(10) NOT NULL DEFAULT '0',\n      `tagID` int(10) NOT NULL DEFAULT '0',\n      PRIMARY KEY (`resourceID`,`tagID`)\n    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;\n\n    ";
if (PerchUtil::count($DB->get_rows('SHOW TABLES LIKE \'' . PERCH_DB_PREFIX . 'resource_log\'')) == 0) {
    if (PerchUtil::count($DB->get_rows('SHOW TABLES LIKE \'' . PERCH_DB_PREFIX . 'content_resources\'')) == 1) {
        $sql .= "\n\n            RENAME TABLE `__PREFIX__content_resources` TO `__PREFIX__resource_log`;\n\n            ALTER TABLE `__PREFIX__resource_log` DROP PRIMARY KEY;\n\n            ALTER TABLE `__PREFIX__resource_log` ADD `logID` INT(10)  UNSIGNED  NOT NULL  AUTO_INCREMENT  PRIMARY KEY FIRST;\n\n            ALTER TABLE `__PREFIX__resource_log` ADD `appID` CHAR(32)  NOT NULL  DEFAULT 'content'  AFTER `logID`;\n\n            ALTER TABLE `__PREFIX__resource_log` ADD `itemFK` CHAR(32)  NOT NULL  DEFAULT 'itemRowID'  AFTER `appID`;\n\n            ALTER TABLE `__PREFIX__resource_log` ADD INDEX `idx_fk` (`itemFK`, `itemRowID`);\n\n            ALTER TABLE `__PREFIX__resource_log` ADD UNIQUE INDEX `idx_uni` (`appID`, `itemFK`, `itemRowID`, `resourceID`);\n\n            ";
    }
}
$sql .= "\n\n    CREATE TABLE IF NOT EXISTS `__PREFIX__resource_log` (\n      `logID` int(10) unsigned NOT NULL AUTO_INCREMENT,\n      `appID` char(32) NOT NULL DEFAULT 'content',\n      `itemFK` char(32) NOT NULL DEFAULT 'itemRowID',\n      `itemRowID` int(10) unsigned NOT NULL DEFAULT '0',\n      `resourceID` int(10) unsigned NOT NULL DEFAULT '0',\n      PRIMARY KEY (`logID`),\n      KEY `idx_resource` (`resourceID`),\n      KEY `idx_fk` (`itemFK`,`itemRowID`),\n      UNIQUE KEY `idx_uni` (`appID`,`itemFK`,`itemRowID`,`resourceID`)\n    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\n    INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n    VALUES ('assets.create','Upload assets',1);\n\n    INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n    VALUES ('assets.manage','Manage assets',2);\n\n\n    CREATE TABLE IF NOT EXISTS `__PREFIX__categories` (\n      `catID` int(10) NOT NULL AUTO_INCREMENT,\n      `setID` int(10) unsigned NOT NULL,\n      `catParentID` int(10) unsigned NOT NULL DEFAULT '0',\n      `catTitle` char(64) NOT NULL DEFAULT '',\n      `catSlug` char(64) NOT NULL DEFAULT '',\n      `catPath` char(255) NOT NULL DEFAULT '',\n      `catDisplayPath` char(255) NOT NULL DEFAULT '',\n      `catOrder` int(10) unsigned NOT NULL DEFAULT '0',\n      `catTreePosition` char(255) NOT NULL DEFAULT '000',\n      `catDynamicFields` text NOT NULL,\n      PRIMARY KEY (`catID`),\n      KEY `idx_set` (`setID`)\n    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\n    CREATE TABLE IF NOT EXISTS `__PREFIX__category_sets` (\n      `setID` int(10) NOT NULL AUTO_INCREMENT,\n      `setTitle` char(64) NOT NULL DEFAULT '',\n      `setSlug` char(64) NOT NULL DEFAULT '',\n      `setTemplate` char(255) NOT NULL DEFAULT 'set.html',\n      `setCatTemplate` char(255) NOT NULL DEFAULT 'category.html',\n      `setDynamicFields` text,\n      PRIMARY KEY (`setID`)\n    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\n    INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n    VALUES ('categories.create','Create new categories',1);\n\n    INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n    VALUES ('categories.delete','Delete categories',2);\n    \n    INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n    VALUES ('categories.manage','Manage categories',3);\n    \n    INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n    VALUES ('categories.sets.create','Create category sets',4);\n    \n    INSERT INTO `__PREFIX__user_privileges` (`privKey`, `privTitle`, `privOrder`)\n    VALUES ('categories.sets.delete','Delete category sets',5);\n\n    ";
$sql = str_replace('__PREFIX__', PERCH_DB_PREFIX, $sql);
$queries = explode(';', $sql);
if (PerchUtil::count($queries) > 0) {
    foreach ($queries as $query) {
        $query = trim($query);
        if ($query != '') {
            $DB->execute($query);
            if ($DB->errored && strpos($DB->error_msg, 'Duplicate') === false) {
                echo '<li class="icon failure error">' . PerchUtil::html(PerchLang::get('The following error occurred:')) . '</li>';
                echo '<li class="failure"><code class="sql">' . PerchUtil::html($query) . '</code></li>';
                echo '<li class="failure"><code>' . PerchUtil::html($DB->error_msg) . '</code></p></li>';
                $errors = true;
            }
        }
    }
}
#  include(PERCH_CORE.'/apps/assets/PerchAssets_Assets.class.php');
#   include(PERCH_CORE.'/apps/assets/PerchAssets_Asset.class.php');
#   $Assets = new PerchAssets_Assets();
#   $Assets->import_from_perch_gallery();
#    $Assets->reindex();
예제 #11
0
	<div class="widget">
		<h2><?php 
    echo $Lang->get('MailChimp');
    ?>
</h2>
		<div class="">
			<?php 
    if ($msg) {
        echo $msg;
    } else {
        if (PerchUtil::count($lists)) {
            echo '<div class="bd">';
            foreach ($lists as $List) {
                echo '<h3>' . PerchUtil::html($List->listTitle()) . '<span class="note">' . PerchUtil::html($List->listMemberCount()) . '</span>' . '</h3>' . "\n";
                $subs = $Subscribers->get_latest_for_list($List);
                if (is_array($subs) && PerchUtil::count($subs) > 0) {
                    echo '<table class="fig">' . "\n";
                    foreach ($subs as $Subscriber) {
                        echo '<tr><td>' . PerchUtil::html($Subscriber->subscriberEmail()) . '</td><td class="note">' . PerchUtil::html(strftime('%d %b %Y', strtotime($Subscriber->subCreated()))) . '</td></tr>' . "\n";
                    }
                    echo '</table>' . "\n";
                }
            }
            echo '</div>';
        }
    }
    ?>
		</div>
	</div>
<?php 
}
예제 #12
0
    <ul class="smartbar">
        <li class="<?php 
echo $status == 'all' ? 'selected' : '';
?>
"><a href="<?php 
echo PerchUtil::html($API->app_path() . '/?status=all');
?>
"><?php 
echo $Lang->get('All');
?>
</a></li>
        <li class="new <?php 
echo $status == 'pending' ? 'selected' : '';
?>
"><a href="<?php 
echo PerchUtil::html($API->app_path() . '/' . '?status=pending');
?>
"><?php 
echo $Lang->get('Pending (%s)', $pending_comment_count);
?>
</a></li>
        <?php 
if ($status == 'pending') {
    $Alert->set('filter', $Lang->get('You are viewing all comments pending moderation.') . ' <a href="' . $API->app_path() . '/?status=all' . '" class="action">' . $Lang->get('Clear Filter') . '</a>');
}
$items = array();
$items[] = array('arg' => 'status', 'val' => 'live', 'label' => 'Live', 'path' => $API->app_path() . '/');
$items[] = array('arg' => 'status', 'val' => 'rejected', 'label' => 'Rejected', 'path' => $API->app_path() . '/');
$items[] = array('arg' => 'status', 'val' => 'spam', 'label' => 'Spam', 'path' => $API->app_path() . '/');
echo PerchUtil::smartbar_filter('cf', 'By Status', 'Filtered by ‘%s’', $items, 'folder', $Alert, "You are viewing ‘%s’ comments", $API->app_path() . '/?status=all');
?>
예제 #13
0
                $FieldType = PerchFieldTypes::get($col['Tag']->type(), false, $col['Tag']);
                $title = $FieldType->render_admin_listing($title);
                if ($col['Tag']->format()) {
                    $title = $Template->format_value($col['Tag'], $title);
                }
            }
            if ($first && trim($title) == '') {
                $title = '#' . $item['_id'];
            }
            echo $title;
            if ($first) {
                echo '</a>';
            }
            echo '</td>';
            $first = false;
        }
        echo '<td>';
        echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH) . '/core/apps/content/delete/item/?id=' . PerchUtil::html($Region->id()) . '&amp;itm=' . PerchUtil::html($item['itemID']) . '" class="delete inline-delete">' . PerchLang::get('Delete') . '</a>';
        echo '</td>';
        echo '</tr>';
        $i++;
    }
    echo '</tbody>';
    echo '</table>';
}
?>



<?php 
include PERCH_PATH . '/core/inc/main_end.php';
예제 #14
0
/* ----------------------------------------- SMART BAR ----------------------------------------- */
?>
    <ul class="smartbar">
        <li><span class="set"><?php 
echo $Lang->get('Filter');
?>
</span></li>
        <li class="selected"><a href="<?php 
echo PerchUtil::html($API->app_path() . '/');
?>
"><?php 
echo $Lang->get('All');
?>
</a></li>
        <li class="fin"><a class="icon reorder" href="<?php 
echo PerchUtil::html($API->app_path() . '/reorder/');
?>
"><?php 
echo $Lang->get('Reorder Albums');
?>
</a></li>
    </ul>
     <?php 
echo $Alert->output();
?>
    <?php 
/* ----------------------------------------- /SMART BAR ----------------------------------------- */
if (PerchUtil::count($albums)) {
    ?>
    <table class="d">
        <thead>
 public static function table_dump($vars, $class = '')
 {
     $out = '';
     if (PerchUtil::count($vars)) {
         $out .= '<table class="' . PerchUtil::html($class, true) . '"><tr><th>ID</th><th>Value</th></tr>';
         foreach ($vars as $key => $val) {
             $out .= '<tr><td><b>' . PerchUtil::html($key) . '</b></td><td>';
             switch (gettype($val)) {
                 case 'array':
                     if (isset($val['processed'])) {
                         $out .= $val['processed'];
                     } else {
                         if (isset($val['_default'])) {
                             $out .= $val['_default'];
                         } else {
                             $out .= '<pre>' . print_r($val, true) . '</pre>';
                         }
                     }
                     break;
                 case 'object':
                     $out .= '<pre>' . print_r($val, true) . '</pre>';
                     break;
                 case 'boolean':
                     $out .= $val ? 'true' : 'false';
                     break;
                 default:
                     if (strlen($val) > 100) {
                         $val = PerchUtil::excerpt_char($val, 100) . '{...}';
                     }
                     $out .= $val;
             }
             $out .= '</td></tr>';
         }
         $out .= '</table>';
     }
     return $out;
 }
예제 #16
0
      

	
	    <h1><?php 
echo PerchLang::get('Deleting the %s Navigation Group', PerchUtil::html($NavGroup->groupTitle()));
?>
</h1>
	

    <form method="post" action="<?php 
echo PerchUtil::html($Form->action());
?>
" class="sectioned">

        <p class="alert notice"><?php 
printf(PerchLang::get('Are you sure you wish to delete the group %s?'), '<strong>' . PerchUtil::html($NavGroup->groupTitle()) . '</strong>');
?>
        </p>
        
        
        
        <p class="submit">
            <?php 
echo $Form->submit('btnsubmit', 'Delete', 'button'), ' ', PerchLang::get('or'), ' <a href="', PERCH_LOGINPATH . '/core/apps/content/navigation/', '">', PerchLang::get('Cancel'), '</a>';
?>
        </p>
        
    </form>
    
<?php 
include PERCH_PATH . '/core/inc/main_end.php';
예제 #17
0
</a></li>
        <li class="<?php 
    echo $filter == 'type' && $type == 'mine' ? 'selected' : '';
    ?>
"><a href="<?php 
    echo PerchUtil::html($API->app_path() . '?type=mine');
    ?>
"><?php 
    echo PerchLang::get('Mine');
    ?>
</a></li>
        <li class="<?php 
    echo $filter == 'type' && $type == 'favorites' ? 'selected' : '';
    ?>
"><a href="<?php 
    echo PerchUtil::html($API->app_path() . '?type=favorites');
    ?>
"><?php 
    echo PerchLang::get('Favorites');
    ?>
</a></li>
        <?php 
    if ($filter == 'type' && $type == 'mine') {
        $Alert->set('filter', PerchLang::get('You are viewing tweets from your own account.') . ' <a href="' . $API->app_path() . '" class="action">' . PerchLang::get('Clear Filter') . '</a>');
    }
    if ($filter == 'type' && $type == 'favorites') {
        $Alert->set('filter', PerchLang::get('You are viewing tweets marked as favorites.') . ' <a href="' . $API->app_path() . '" class="action">' . PerchLang::get('Clear Filter') . '</a>');
    }
    ?>
    </ul>
예제 #18
0
            </tr>
        </thead>
        <tbody>
        <?php 
    if (PerchUtil::count($contentItems) > 0) {
        $prev = false;
        $prev_url = false;
        $level = 0;
        foreach ($contentItems as $item) {
            echo '<tr class="' . PerchUtil::flip('odd') . '">';
            echo '<td class="level' . $level . ' page"><span>' . PerchUtil::html(PerchUtil::filename($item->Alias(), false)) . '</span></td>';
            echo '<td>' . PerchUtil::html($item->Location()) . '</td>';
            echo '<td>' . PerchUtil::html($PerchPage->template_display_name($item->Template())) . '</td>';
            echo '<td>';
            if ($CurrentUser->userRole() == 'Admin' || $CurrentUser->userRole() == 'Editor' && $Settings->get('editorMayDeleteRegions')->settingValue()) {
                echo '<a href="delete?id=' . PerchUtil::html($item->id()) . '" class="delete">' . PerchLang::get('Delete') . '</a>';
            } else {
                echo '&nbsp;';
            }
            echo '</td>';
            echo '</tr>';
        }
    }
    ?>
        </tbody>
		<tfoot>
			<tr>
				<td>
					<a href="add?id=<?php 
    echo PerchUtil::count($contentItems) + 1;
    ?>
예제 #19
0
            </form>
<?php 
}
// token_expired
if ($mode == 'password_set') {
    ?>
            <form action="<?php 
    echo PerchUtil::html(PERCH_LOGINPATH);
    ?>
/" method="post" class="reset">
                <p class="instructions"><?php 
    echo PerchLang::get('Thank you. Your new password has been set and you can now log in using it.');
    ?>
</p>
                <p class="instructions"><?php 
    echo PerchLang::get('%sLog in%s', '<a href="' . PerchUtil::html(PERCH_LOGINPATH) . '" class="button">', '</a>');
    ?>
</p>
            </form>
<?php 
}
// password_set
?>

        </div>

    </div>


<?php 
include PERCH_CORE . '/inc/btm.php';
예제 #20
0
	</h2>
	<div class="bd">
		<?php 
if (PerchUtil::count($images)) {
    echo '<div class="fig">';
    foreach ($images as $Image) {
        if (is_object($Image)) {
            $admin_thumb = $Image->image_admin_preview();
            if (is_object($admin_thumb)) {
                echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/addons/apps/perch_gallery/images/edit/?album_id=' . $Image->albumID() . '&id=' . $Image->id()) . '">';
                echo '<img src="' . $admin_thumb->path() . '" alt="' . PerchUtil::html($Image->imageAlt()) . '" />';
                echo '</a>';
            }
        }
    }
    echo '</div>';
}
if (PerchUtil::count($albums)) {
    echo '<ul>';
    foreach ($albums as $Album) {
        echo '<li>';
        echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/addons/apps/perch_gallery/images/?id=' . $Album->id()) . '">';
        echo PerchUtil::html($Album->albumTitle());
        echo '</a>';
        echo '</li>';
    }
    echo '</ul>';
}
?>
	</div>
</div>
 private function _auto_link_text_callback($matches)
 {
     $max_url_length = 50;
     $max_depth_if_over_length = 2;
     $ellipsis = '&hellip;';
     $url_full = $matches[0];
     $url_short = '';
     if (strlen($url_full) > $max_url_length) {
         $parts = parse_url($url_full);
         $url_short = $parts['scheme'] . '://' . preg_replace('/^www\\./', '', $parts['host']) . '/';
         $path_components = explode('/', trim($parts['path'], '/'));
         foreach ($path_components as $dir) {
             $url_string_components[] = $dir . '/';
         }
         if (!empty($parts['query'])) {
             $url_string_components[] = '?' . $parts['query'];
         }
         if (!empty($parts['fragment'])) {
             $url_string_components[] = '#' . $parts['fragment'];
         }
         for ($k = 0; $k < count($url_string_components); $k++) {
             $curr_component = $url_string_components[$k];
             if ($k >= $max_depth_if_over_length || strlen($url_short) + strlen($curr_component) > $max_url_length) {
                 if ($k == 0 && strlen($url_short) < $max_url_length) {
                     // Always show a portion of first directory
                     $url_short .= substr($curr_component, 0, $max_url_length - strlen($url_short));
                 }
                 $url_short .= $ellipsis;
                 break;
             }
             $url_short .= $curr_component;
         }
     } else {
         $url_short = $url_full;
     }
     return "<a rel=\"nofollow\" href=\"" . PerchUtil::html($url_full) . "\" title=\"" . PerchUtil::html($url_full) . "\">" . PerchUtil::html($url_short) . "</a>";
 }
예제 #22
0
      

	
	    <h1><?php 
echo PerchLang::get('Deleting the %s Page', PerchUtil::html($Page->pageNavText()));
?>
</h1>
	

    <form method="post" action="<?php 
echo PerchUtil::html($Form->action());
?>
" class="sectioned">

        <p class="alert notice"><?php 
printf(PerchLang::get('Are you sure you wish to delete the page %s?'), '<strong>' . PerchUtil::html($Page->pageNavText()) . '</strong>');
?>
        </p>
        
        
        
        <p class="submit">
            <?php 
echo $Form->submit('btnsubmit', 'Delete', 'button'), ' ', PerchLang::get('or'), ' <a href="', PERCH_LOGINPATH . '/core/apps/content', '">', PerchLang::get('Cancel'), '</a>';
?>
        </p>
        
    </form>
    
<?php 
include PERCH_PATH . '/core/inc/main_end.php';
예제 #23
0
<form method="post" action="<?php 
echo PerchUtil::html($Form->action());
?>
">
    <div>
        <button type="submit" class="button topadd"><img src="<?php 
echo $API->app_path();
?>
/assets/sync.svg" width="12" class="sync" /> <?php 
echo $Lang->get('Sync');
?>
</button>
        <?php 
echo $Form->submit('sync', 'Sync', 'hidden');
?>
    </div>
    <style>
        .sync {
            width: 12px;
            display: inline-block;
            margin-right: 2px;
            vertical-align: top;
            opacity: 0.7;
        }
    </style>
</form>
 private function html($str, $quotes = false)
 {
     if ($this->html_encode) {
         return PerchUtil::html($str, $quotes);
     } else {
         return $str;
     }
 }
예제 #25
0
            }
            echo '<td id="page' . $Page->id() . '" class="level' . ((int) $Page->pageDepth() - 1) . ($do_list_collapse ? '' : ' notoggle') . ' page' . $closed . ' primary">';
            if ($do_list_collapse && $Page->subpages()) {
                $arg = $closed ? 'ex' : 'cl';
                echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/core/apps/content/?' . $arg . '=' . $Page->id()) . '" class="toggle icon"><span>+</span></a>';
            }
            echo '  <a class="icon page" href="' . PerchUtil::html(PERCH_LOGINPATH) . '/core/apps/content/page/?id=' . PerchUtil::html($Page->id()) . '"><span>' . PerchUtil::html($Page->pageNavText()) . '</span></a>';
            if ($CurrentUser->has_priv('content.pages.create') && $Page->role_may_create_subpages($CurrentUser) && $Page->pagePath() != '*') {
                echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/core/apps/content/page/add/?pid=' . $Page->id()) . '" class="create-subpage">' . PerchLang::get('New subpage') . '</a>';
            }
            echo '</td>';
            echo '<td></td>';
            // Delete
            echo '<td>';
            if (($CurrentUser->has_priv('content.pages.delete') || $CurrentUser->has_priv('content.pages.delete.own') && $Page->pageCreatorID() == $CurrentUser->id()) && !$Page->subpages()) {
                echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH) . '/core/apps/content/page/delete/?id=' . PerchUtil::html($Page->id()) . '" class="delete inline-delete">' . PerchLang::get('Delete') . '</a>';
            } else {
                //echo '<span class="delete action">'.PerchLang::get('Delete').'</span>';
            }
            echo '</td>';
            echo '</tr>';
        }
    }
    ?>
        </tbody>
    </table>
    <?php 
} else {
    ?>
        
        <?php 
예제 #26
0
        </thead>
        <tbody>
        <?php 
    foreach ($cats as $Cat) {
        echo '<tr>';
        echo '<td id="cat' . $Cat->id() . '" class="level' . ((int) $Cat->catDepth() - 2) . ' primary">';
        echo '  <a class="icon category" href="' . PerchUtil::html(PERCH_LOGINPATH) . '/core/apps/categories/edit/?id=' . PerchUtil::html($Cat->id()) . '"><span>' . PerchUtil::html($Cat->catTitle()) . '</span></a>';
        if ($CurrentUser->has_priv('categories.create')) {
            echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/core/apps/categories/edit/?pid=' . $Cat->id()) . '" class="create-subpage">' . PerchLang::get('New subcategory') . '</a>';
        }
        echo '</td>';
        echo '<td>' . PerchUtil::html($Cat->catPath()) . '</td>';
        // Delete
        echo '<td>';
        if ($CurrentUser->has_priv('categories.delete')) {
            echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH) . '/core/apps/categories/delete/?id=' . PerchUtil::html($Cat->id()) . '" class="delete inline-delete">' . PerchLang::get('Delete') . '</a>';
        }
        echo '</td>';
        echo '</tr>';
    }
    ?>
        </tbody>
    </table>
    <?php 
}
?>

<?php 
include PERCH_PATH . '/core/inc/main_end.php';
?>
        
<div class="main">
	<div class="body">
		<div class="inner">
			<h1>Software Update</h1>	
			<?php 
if (!$Paging->is_last_page()) {
    echo '<ul class="updates">';
    echo '<li class="icon success">Updating posts ' . $Paging->lower_bound() . ' to ' . $Paging->upper_bound() . ' of ' . $Paging->total() . '.</li>';
    echo '</ul>';
} else {
    echo '<p class="info"><a href="' . $API->app_path() . '" class="button">Continue</a></p>';
}
?>
		</div>
	</div>
<?php 
if (!$Paging->is_last_page()) {
    $paging = $Paging->to_array();
    echo "<script>\n\t\t\t\twindow.setTimeout(function(){\n\t\t\t\t\twindow.location='" . PerchUtil::html($paging['next_url'], true) . "';\n\t\t\t\t}, 0)\n\t\t\t\t\n\t\t\t </script>";
}
예제 #28
0
/core/assets/css/ie7.css?v=<?php 
    echo PerchUtil::html($Perch->version);
    ?>
" type="text/css" /><![endif]-->
	<!--[if IE 6]><link rel="stylesheet" href="<?php 
    echo PerchUtil::html(PERCH_LOGINPATH);
    ?>
/core/assets/css/ie6.css?v=<?php 
    echo PerchUtil::html($Perch->version);
    ?>
" type="text/css" /><![endif]-->	
<?php 
    if (PERCH_DEBUG) {
        ?>
<link rel="stylesheet" href="<?php 
        echo PerchUtil::html(PERCH_LOGINPATH);
        ?>
/core/assets/css/debug.css" type="text/css" /><?php 
    }
}
?>
    
</head>
<body class="sidebar-closed">
	<div class="main">
		<div class="body">
			<div class="inner">
				<h1>Software Update</h1>

				<ul class="updates">
				<?php 
예제 #29
0
 }
 // test that it worked
 $tables = $db->get_rows('SHOW TABLES');
 $db_fail = true;
 if (PerchUtil::count($tables)) {
     foreach ($tables as $key => $val) {
         foreach ($val as $key2 => $val2) {
             if ($val2 == PERCH_DB_PREFIX . 'users') {
                 $db_fail = false;
             }
         }
     }
 }
 if (PerchUtil::count($msgs)) {
     foreach ($msgs as $msg) {
         echo '<li class="failure icon"><strong>Error:</strong> ' . PerchUtil::html($msg) . '</li>';
     }
 }
 if ($db_fail || PerchUtil::count($msgs)) {
     echo '<li class="failure icon">Creating database tables&hellip; <strong>Unable to create database tables.</strong></li>';
     echo '</ul>';
     echo '<p>The most likely cause is that your database access details aren\'t quite right. Please double check them. Note that some hosting control panel software (like cPanel) will prefix the database name with your account name. So if you created a new database called <code>' . PERCH_DB_DATABASE . '</code> the full name could be something like <code>accountname_' . PERCH_DB_DATABASE . '</code>.</p>';
     echo '<p>If you\'re still have trouble, it\'s possible that the MySQL user hasn\'t got enough access rights to create tables. Change this, if you can, <a href="index.php?install=1">then reload this page</a>.</p>';
     echo '<p>Still no success? <a href="https://grabaperch.com/support">Drop us a line</a> and we\'ll see if we can help.</p>';
 } else {
     echo '<li class="success icon">Creating database tables&hellip; done.</li>';
     $Users = new PerchUsers();
     $data = PerchSession::get('user');
     $data['userMasterAdmin'] = '1';
     $data['roleID'] = '2';
     $data['userCreated'] = date('Y-m-d H:i:s');
예제 #30
0
echo PerchLang::get('Adding a New User Account');
?>
</h1>


    <?php 
echo $Alert->output();
?>

    <h2><?php 
echo PerchLang::get('User details');
?>
</h2>

    <form action="<?php 
echo PerchUtil::html($fCreateUser->action());
?>
" method="post" class="sectioned" autocomplete="off">
		
        <div class="field <?php 
echo $fCreateUser->error('userUsername', false);
?>
">
            <?php 
echo $fCreateUser->label('userUsername', 'Username');
?>
            <?php 
echo $fCreateUser->text('userUsername', $fCreateUser->get(false, 'userUsername'), '');
if (PERCH_PARANOID) {
    echo $fCreateUser->hint(PerchLang::get('Usernames are case-sensitive'));
}