public function get_templates($path = false, $include_hidden = false, $initial_path = false)
 {
     $Perch = Perch::fetch();
     if ($path === false) {
         $path = PERCH_TEMPLATE_PATH . '/categories';
     }
     if ($initial_path === false) {
         $initial_path = $path;
     }
     $a = array();
     if (is_dir($path)) {
         if ($dh = opendir($path)) {
             while (($file = readdir($dh)) !== false) {
                 if (substr($file, 0, 1) != '.' && ($include_hidden || substr($file, 0, 1) != '_') && !preg_match($Perch->ignore_pattern, $file)) {
                     $extension = PerchUtil::file_extension($file);
                     if ($extension == 'html' || $extension == 'htm') {
                         $p = str_replace($initial_path, '', $path);
                         if (!$p) {
                             $a[PerchLang::get('Categories')][] = array('filename' => $file, 'path' => $file, 'label' => $this->template_display_name($file));
                         } else {
                             $a[] = array('filename' => $file, 'path' => ltrim($p, '/') . '/' . $file, 'label' => $this->template_display_name($file));
                         }
                     } else {
                         $a[$this->template_display_name($file)] = $this->get_templates($path . '/' . $file, $include_hidden, $initial_path);
                     }
                 }
             }
             closedir($dh);
         }
         if (PerchUtil::count($a)) {
             $a = PerchUtil::array_sort($a, 'label');
         }
     }
     return $a;
 }
 public static function get_lang_options()
 {
     $Lang = PerchLang::fetch();
     $out = array();
     // Addons folder
     if (is_dir(PerchUtil::file_path(PERCH_PATH . '/addons/lang'))) {
         $lang_dir = PerchUtil::file_path(PERCH_PATH . '/addons/lang');
         $files = PerchUtil::get_dir_contents($lang_dir, false);
         if (is_array($files)) {
             foreach ($files as $file) {
                 $out[] = PerchUtil::strip_file_extension($file);
             }
         }
     }
     // Core folder
     $lang_dir = PerchUtil::file_path(PERCH_CORE . '/lang');
     if (is_dir($lang_dir)) {
         $files = PerchUtil::get_dir_contents($lang_dir, false);
         if (is_array($files)) {
             foreach ($files as $file) {
                 $f = PerchUtil::strip_file_extension($file);
                 if (!in_array($f, $out)) {
                     $out[] = $f;
                 }
             }
         }
     }
     if (PerchUtil::count($out)) {
         sort($out);
         return $out;
     }
     return false;
 }
 public function get_templates($template_ids = false)
 {
     $a = array();
     $templates = $this->get_filtered($template_ids);
     if (PerchUtil::count($templates)) {
         foreach ($templates as $Template) {
             $segments = explode('/', $Template->templatePath());
             if (count($segments) == 1) {
                 $a[PerchLang::get('General')][] = array('id' => $Template->id(), 'label' => $Template->templateTitle());
             } else {
                 $file = array_pop($segments);
                 $tmp = array('id' => $Template->id(), 'label' => $Template->templateTitle());
                 $target =& $a;
                 for ($i = 0; $i < count($segments); $i++) {
                     $label = $this->template_display_name($segments[$i]);
                     if (!isset($a[$label])) {
                         $a[$label] = array();
                     }
                     $target =& $a[$label];
                 }
                 $target[] = $tmp;
             }
         }
     }
     return $a;
 }
 function __construct($version = 1.0, $app_id)
 {
     $this->app_id = $app_id;
     $this->version = $version;
     if (!defined('PERCH_APPS_EDITOR_PLUGIN')) {
         define('PERCH_APPS_EDITOR_PLUGIN', 'markitup');
     }
     if (!defined('PERCH_APPS_EDITOR_MARKUP_LANGUAGE')) {
         define('PERCH_APPS_EDITOR_MARKUP_LANGUAGE', 'textile');
     }
     if (strpos($app_id, '_') === false) {
         $this->Lang = PerchLang::fetch();
     }
 }
 /**
  * Get an array of templates in the content folder.
  *
  * @param string $path 
  * @return void
  * @author Drew McLellan
  */
 public function get_templates($path = false, $include_hidden = false, $initial_path = false)
 {
     $Perch = Perch::fetch();
     if ($path === false) {
         $path = PERCH_TEMPLATE_PATH . '/forms/emails';
     }
     if ($initial_path === false) {
         $initial_path = $path;
     }
     $a = array();
     $groups = array();
     $p = false;
     if (is_dir($path)) {
         if ($dh = opendir($path)) {
             while (($file = readdir($dh)) !== false) {
                 if (substr($file, 0, 1) != '.' && ($include_hidden || substr($file, 0, 1) != '_') && !preg_match($Perch->ignore_pattern, $file)) {
                     $extension = PerchUtil::file_extension($file);
                     if ($extension == 'html' || $extension == 'htm') {
                         $p = str_replace($initial_path, '', $path);
                         if (!$p) {
                             $a[PerchLang::get('Templates')][] = array('filename' => $file, 'value' => $file, 'path' => $file, 'label' => $this->template_display_name($file));
                         } else {
                             $a[] = array('filename' => $file, 'value' => ltrim($p, '/') . '/' . $file, 'path' => ltrim($p, '/') . '/' . $file, 'label' => $this->template_display_name($file));
                         }
                     } else {
                         // Use this one of infinite recursive nesting. Group stuff below normalised for HTML select optgroups that only do one level
                         //$a[$this->template_display_name($file)] = $this->get_templates($path.'/'.$file, $include_hidden, $initial_path);
                         if ($p) {
                             $group_name = $this->template_display_name(trim($p, '/\\') . '/' . $file);
                         } else {
                             $group_name = $this->template_display_name($file);
                         }
                         $groups[$group_name] = $this->get_templates($path . '/' . $file, $include_hidden, $initial_path);
                     }
                 }
             }
             closedir($dh);
         }
         if (PerchUtil::count($a)) {
             $a = PerchUtil::array_sort($a, 'label');
         }
     }
     return $a + $groups;
 }
Exemple #6
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';
Exemple #7
0
	<h2>
		<?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>
        $Resources = new PerchResources();
        $ids = $Resources->get_logged_ids();
        $assetID = array_shift($ids);
        $Asset = $Assets->find($assetID);
        $created = true;
    }
    if ($Asset) {
        if ($data['resourceInLibrary'] == '1') {
            $Asset->mark_as_library();
        }
        $Asset->update($data);
        $Asset->reindex();
        // Tags
        if (isset($_POST['tags']) && trim($_POST['tags']) != '') {
            $tag_string = trim($_POST['tags']);
            $Tags->assign_tag_string($Asset->id(), $tag_string, true);
        }
        if ($created) {
            //PerchUtil::redirect(PERCH_LOGINPATH.'/core/apps/assets/edit/?id='.$Asset->id().'&created=1');
        }
        $Alert->set('success', PerchLang::get('Successfully updated'));
    }
}
if (isset($_GET['created'])) {
    $Alert->set('success', PerchLang::get('Successfully created'));
}
if ($Asset) {
    $details = $Asset->to_array();
} else {
    $details = new ArrayObject();
}
        //$opts[PerchLang::get('General')][] = array('label'=>PerchLang::get('Local file'), 'value'=>'');
        echo $Form->grouped_select('templateID', $opts, $Form->get($details, 'templateID'));
    } else {
        echo '<a href="' . PERCH_LOGINPATH . '/core/apps/content/page/templates/">' . PerchLang::get('Manage templates') . '</a>';
    }
} else {
    $templates = $Templates->all();
    $opts = array();
    if (PerchUtil::count($templates)) {
        foreach ($templates as $Template) {
            $opts[] = array('label' => $Template->templateTitle(), 'value' => $Template->id());
        }
        $opts[] = array('label' => PerchLang::get('Page already exists, or is a link only'), 'value' => '');
        echo $Form->select('templateID', $opts, $Form->get($details, 'templateID'));
    } else {
        echo '<a href="' . PERCH_LOGINPATH . '/core/apps/content/page/templates/">' . PerchLang::get('Manage templates') . '</a>';
    }
}
?>
        </div>
        <?php 
if (!PERCH_RUNWAY) {
    ?>
        <div class="field checkboxes labelless">
            <div class="checkbox">
                <?php 
    echo $Form->checkbox('create_folder', '1', $Form->get($details, 'create_folder'));
    ?>
                <?php 
    echo $Form->label('create_folder', 'This page will have more pages below it');
    ?>
<?php

$Roles = new PerchUserRoles();
$roles = $Roles->all();
/* --------- New User Form ----------- */
$fCreateUser = new PerchForm('createuser', false);
$req = array();
$req['userUsername'] = "******";
$req['userGivenName'] = "Required";
$req['userFamilyName'] = "Required";
$req['userEmail'] = "Required";
$req['userPassword'] = "******";
$req['roleID'] = "Required";
$fCreateUser->set_required($req);
$validation = array();
$validation['userUsername'] = array("username", PerchLang::get("Username not available, try another."));
$validation['userEmail'] = array("email", PerchLang::get("Email incomplete or already in use."));
$fCreateUser->set_validation($validation);
if ($fCreateUser->posted() && $fCreateUser->validate()) {
    $data = array();
    $postvars = array('userUsername', 'userGivenName', 'userFamilyName', 'userEmail', 'userPassword', 'roleID');
    $data = $fCreateUser->receive($postvars);
    $sendEmail = false;
    if (isset($_POST['sendEmail']) && $_POST['sendEmail'] == '1') {
        $sendEmail = true;
    }
    $Users->create($data, $sendEmail);
    $Alert->set('success', PerchLang::get('User successfully created.'));
    $fCreateUser->clear();
}
Exemple #11
0
">
                <?php 
echo $Form->label('userPassword', 'New password');
?>
                <?php 
echo $Form->password('userPassword', '');
?>
            </div>
            <div class="field <?php 
echo $Form->error('userPassword2', false);
?>
">
                <?php 
echo $Form->label('userPassword2', 'Repeat new password');
?>
                <?php 
echo $Form->password('userPassword2', '');
?>
            </div>
        </fieldset>

		<p class="submit">
			<?php 
echo $Form->submit('submit', 'Save changes', 'button');
echo ' ' . PerchLang::get('or') . ' <a href="' . PERCH_LOGINPATH . '">' . PerchLang::get('Cancel') . '</a>';
?>
		</p>
	</form>

<?php 
include PERCH_PATH . '/core/inc/main_end.php';
 include '_app_settings.pre.php';
 $data = $Form->receive($postvars);
 foreach ($checkboxes as $checkbox) {
     if (!isset($data[$checkbox])) {
         $data[$checkbox] = '0';
     }
 }
 if (isset($_POST['logo_remove']) && $_POST['logo_remove'] == '1') {
     $data['logoPath'] = '';
 }
 foreach ($data as $key => $value) {
     $Settings->set($key, $value);
 }
 $Lang = PerchLang::fetch();
 $Lang->reload();
 $Alert->set('success', PerchLang::get("Your settings have been updated."));
 // image upload
 if (isset($_FILES['customlogo']) && (int) $_FILES['customlogo']['size'] > 0) {
     if (is_array(getimagesize($_FILES['customlogo']['tmp_name']))) {
         $filename = $_FILES['customlogo']['name'];
         if (strpos($filename, '.php') !== false) {
             $filename .= '.txt';
         }
         // diffuse PHP files
         $target = PERCH_RESFILEPATH . '/' . $filename;
         if (file_exists($target)) {
             $filename = time() . '_' . $_FILES['customlogo']['name'];
             $target = PERCH_RESFILEPATH . '/' . $filename;
         }
         PerchUtil::move_uploaded_file($_FILES['customlogo']['tmp_name'], $target);
         $Settings->set('logoPath', PERCH_RESPATH . '/' . $filename);
?>
            </div>
            <div class="checkbox">
                <?php 
echo $Form->radio('pages-grant', 'pages', 'grant', false);
?>
                <?php 
echo $Form->label('pages-grant', 'Grant role permission create new subpages of all current pages');
?>
            </div>
            <div class="checkbox">
                <?php 
echo $Form->radio('pages-revoke', 'pages', 'revoke', false);
?>
                <?php 
echo $Form->label('pages-revoke', 'Revoke role permission to create new subpages');
?>
            </div>
        </fieldset>
 

        <p class="submit">
            <?php 
echo $Form->submit('submit', 'Make changes', 'button');
echo ' ' . PerchLang::get('or') . ' <a href="' . PERCH_LOGINPATH . '/core/users/roles/">' . PerchLang::get('Cancel') . '</a>';
?>
        </p>
    </form>

<?php 
include PERCH_PATH . '/core/inc/main_end.php';
include PERCH_PATH . '/core/inc/sidebar_start.php';
echo $HTML->para('Update your category set.');
include PERCH_PATH . '/core/inc/sidebar_end.php';
include PERCH_PATH . '/core/inc/main_start.php';
include '_subnav.php';
if ($Set) {
    echo $HTML->heading1('Editing ‘%s’ Category Set', $Set->setTitle());
} else {
    echo $HTML->heading1('Adding a New Category Set');
}
// Set up a smartbar
if ($Set) {
    echo $HTML->smartbar($HTML->smartbar_breadcrumb(false, array('link' => PERCH_LOGINPATH . '/core/apps/categories/sets/?id=' . $Set->id(), 'label' => $Set->setTitle())), $HTML->smartbar_link(true, array('link' => PERCH_LOGINPATH . '/core/apps/categories/sets/edit?id=' . $Set->id(), 'label' => PerchLang::get('Set Options'))), $HTML->smartbar_link(false, array('link' => PERCH_LOGINPATH . '/core/apps/categories/reorder/?id=' . $Set->id(), 'label' => PerchLang::get('Reorder Categories'), 'class' => 'icon reorder'), true));
} else {
    echo $HTML->smartbar($HTML->smartbar_breadcrumb(true, array('link' => PERCH_LOGINPATH . '/core/apps/categories/sets/', 'label' => PerchLang::get('New Set'))));
}
// If a success or failure message has been set, output that here
echo $message;
// Sub head
echo $HTML->heading2('Details');
// Output the edit form
echo $Form->form_start();
$details = array();
if (is_object($Set)) {
    $details = $Set->to_array();
}
echo $Form->fields_from_template($Template, $details, array(), false);
$opts = array();
$templates = $Sets->get_templates();
if (PerchUtil::count($templates)) {
        }
        $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);
        ?>
            <?php 
        switch ($setting['type']) {
            case 'text':
                echo $Form->text($id, $Form->get($details, $id, $setting['default']));
                break;
            case 'checkbox':
                echo $Form->checkbox($id, true, $Form->get($details, $id));
                break;
            case 'textarea':
                echo $Form->textarea($id, $Form->get($details, $id, $setting['default']));
                break;
            case 'select':
                if (PerchUtil::count($setting['opts'])) {
                    foreach ($setting['opts'] as &$opt) {
Exemple #16
0
<?php

include __DIR__ . '/../../../inc/pre_config.php';
include __DIR__ . '/../../../../config/config.php';
include PERCH_CORE . '/inc/loader.php';
$Perch = PerchAdmin::fetch();
include PERCH_CORE . '/inc/auth.php';
if (!$CurrentUser->has_priv('perch.users.manage')) {
    PerchUtil::redirect(PERCH_LOGINPATH);
}
$Perch->page_title = PerchLang::get('Manage Roles');
$Alert = new PerchAlert();
include PERCH_CORE . '/users/modes/roles.edit.pre.php';
include PERCH_CORE . '/inc/top.php';
include PERCH_CORE . '/users/modes/roles.edit.post.php';
include PERCH_CORE . '/inc/btm.php';
        </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';
?>
        
Exemple #18
0
"><?php 
    echo PerchLang::get('Reorder Pages');
    ?>
</a></li><?php 
}
?>
    </ul>
    <?php 
/* ----------------------------------------- /SMART BAR ----------------------------------------- */
?>




    <h2><?php 
echo PerchLang::get('Details');
?>
</h2>
    <form method="post" action="<?php 
echo PerchUtil::html($Form->action());
?>
" class="sectioned">

        <div class="field">
            <?php 
echo $Form->label('groupTitle', 'Title');
?>
            <?php 
echo $Form->text('groupTitle', $Form->get($details, 'groupTitle'));
?>
        </div>
    PerchUtil::redirect(PERCH_LOGINPATH . '/users');
}
$Roles = new PerchUserRoles();
$roles = $Roles->all();
/* --------- Edit User Form ----------- */
$Form = new PerchForm('user', false);
$req = array();
$req['userUsername'] = "******";
$req['userGivenName'] = "Required";
$req['userFamilyName'] = "Required";
$req['userEmail'] = "Required";
if ($User->id() != $CurrentUser->id()) {
    $req['roleID'] = "Required";
}
$Form->set_required($req);
$validation = array();
$validation['userUsername'] = array("username", PerchLang::get("Username not available, try another."), array('userID' => $User->id()));
$validation['userEmail'] = array("email", PerchLang::get("Email incomplete or already in use."), array('userID' => $User->id()));
$Form->set_validation($validation);
if ($Form->posted() && $Form->validate()) {
    $data = array();
    $postvars = array('userUsername', 'userGivenName', 'userFamilyName', 'userEmail', 'roleID');
    $data = $Form->receive($postvars);
    $User->update($data);
    $Alert->set('success', PerchLang::get('User successfully updated.'));
}
if (isset($_POST['resetPwd']) && $_POST['resetPwd'] == '1') {
    $User->reset_pwd_and_notify();
    $Alert->set('success', PerchLang::get('A new password has been sent by email.'));
}
$details = $User->to_array();
Exemple #20
0
<?php

include __DIR__ . '/../../../inc/pre_config.php';
include __DIR__ . '/../../../../config/config.php';
include PERCH_CORE . '/inc/loader.php';
if (!PERCH_RUNWAY) {
    PerchUtil::redirect(PERCH_LOGINPATH . '/core/settings/');
}
$Perch = PerchAdmin::fetch();
include PERCH_CORE . '/inc/auth.php';
if (!$CurrentUser->has_priv('perch.settings')) {
    PerchUtil::redirect(PERCH_LOGINPATH);
}
$Perch->page_title = PerchLang::get('Backup Settings');
$Alert = new PerchAlert();
$app_path = __DIR__ . '/../..';
include PERCH_CORE . '/runway/settings/inc/backup.php';
include PERCH_CORE . '/runway/settings/modes/backup.plans.edit.pre.php';
include PERCH_CORE . '/inc/top.php';
include PERCH_CORE . '/runway/settings/modes/backup.plans.edit.post.php';
include PERCH_CORE . '/inc/btm.php';
Exemple #21
0
<?php

include realpath(__DIR__ . '/../../..') . '/inc/pre_config.php';
include realpath(__DIR__ . '/../../../..') . '/config/config.php';
include PERCH_CORE . '/inc/loader.php';
$Perch = PerchAdmin::fetch();
include PERCH_CORE . '/inc/auth_light.php';
$Perch->page_title = PerchLang::get('Manage Assets');
include __DIR__ . '/../PerchAssets_Asset.class.php';
include __DIR__ . '/../PerchAssets_Assets.class.php';
include __DIR__ . '/../PerchAssets_Tags.class.php';
include __DIR__ . '/../PerchAssets_Tag.class.php';
$Paging = new PerchPaging();
$Paging->set_per_page(32);
$Assets = new PerchAssets_Assets();
$view = 'grid';
$filters = array();
if (isset($_GET['filter']) && $_GET['filter'] == 'new') {
    $filters['new'] = true;
}
if (isset($_GET['app']) && $_GET['app'] != '') {
    $filters['app'] = $_GET['app'];
}
if (isset($_GET['type']) && $_GET['type'] != '') {
    $filters['type'] = $_GET['type'];
}
if (isset($_GET['bucket']) && $_GET['bucket'] != '') {
    $filters['bucket'] = $_GET['bucket'];
}
if (isset($_GET['date']) && $_GET['date'] != '') {
    $filters['date'] = $_GET['date'];
Exemple #22
0
<?php

include dirname(__FILE__) . '/../../../config/config.php';
include PERCH_PATH . '/inc/loader.php';
$Perch = PerchAdmin::fetch();
include PERCH_PATH . '/inc/auth.php';
$Perch->find_installed_apps();
$Perch->page_title = PerchLang::get('Add Page');
include dirname(__FILE__) . '/../PerchPages.class.php';
include dirname(__FILE__) . '/../PerchPagesItem.class.php';
$PerchPage = new PerchPage();
include dirname(__FILE__) . '/../modes/add.pre.php';
include PERCH_PATH . '/inc/top.php';
include dirname(__FILE__) . '/../modes/add.post.php';
include PERCH_PATH . '/inc/btm.php';
Exemple #23
0
    $groupID = false;
    $NavGroup = false;
}
$Form = new PerchForm('editpage');
$req = array();
$req['groupTitle'] = "Required";
$Form->set_required($req);
if ($Form->posted() && $Form->validate()) {
    $postvars = array('groupTitle');
    $data = $Form->receive($postvars);
    if (is_object($NavGroup)) {
        $NavGroup->update($data);
        $Alert->set('success', PerchLang::get('Your navigation group has been successfully updated.'));
    } else {
        $data['groupSlug'] = PerchUtil::urlify($data['groupTitle']);
        $NavGroup = $NavGroups->create($data);
        if (is_object($NavGroup)) {
            PerchUtil::redirect(PERCH_LOGINPATH . '/core/apps/content/navigation/edit/?id=' . $NavGroup->id() . '&created=1');
        } else {
            $Alert->set('failure', PerchLang::get('There was a problem creating the navigation group.'));
        }
    }
}
if (isset($_GET['created'])) {
    $Alert->set('success', PerchLang::get('Your navigation group has been successfully created.'));
}
if (is_object($NavGroup)) {
    $details = $NavGroup->to_array();
} else {
    $details = array();
}
 public function submit($id, $value, $class = false, $translate = true, $use_button = false)
 {
     $Perch = PerchAdmin::fetch();
     if ($this->display_only) {
         if ($this->allow_edits) {
             $segments = str_replace('/editform=' . $this->name, '', split('/', $Perch->get_page(true)));
             $segments[] = 'editform=' . $this->name;
             $url = implode('/', $segments);
             $url = str_replace('//', '/', $url);
             return '<a href="' . $url . '" class="button" id="' . $this->html($id, true) . '">Edit</a>';
         }
         return '';
     }
     if ($translate) {
         $value = PerchLang::get($value);
     }
     if ($use_button) {
         $s = '<button type="submit" name="' . $this->html($id, true) . '" id="' . $this->html($id, true) . '" value="' . $this->html($value, true) . '" class="' . $this->html($class, true) . '"><span></span>' . $this->html($value, true) . '</button>';
     } else {
         $s = '<input type="submit" name="' . $this->html($id, true) . '" id="' . $this->html($id, true) . '" value="' . $this->html($value, true) . '" class="' . $this->html($class, true) . '" />';
     }
     $s .= '<input type="hidden" name="formaction" value="' . $this->html($this->name, true) . '" />';
     $s .= '<input type="hidden" name="token" value="' . $this->html(PerchSession::get('csrf_token'), true) . '" />';
     return $s;
 }
Exemple #25
0
        
        <?php 
    if ($filter == 'all') {
        ?>
            <p class="alert filter"><?php 
        echo PerchLang::get('No content yet?');
        ?>
 <?php 
        echo PerchLang::get('Make sure you have added some editable regions into your page, and then visited that page in your browser. Once you have, the regions should show up here.');
        ?>
                <a href="http://grabaperch.com/go/gettingstarted"><?php 
        echo PerchLang::get('Read the getting started guide to find out more');
        ?>
&hellip;</a></p>
        <?php 
    } else {
        ?>
            <p class="alert filter"><?php 
        echo PerchLang::get('Sorry, there\'s currently no content available based on that filter');
        ?>
 - <a href="?by=all"><?php 
        echo PerchLang::get('View all');
        ?>
</a></p>
        <?php 
    }
    ?>
        
    <?php 
}
include PERCH_PATH . '/core/inc/main_end.php';
Exemple #26
0
<?php

include __DIR__ . '/../../inc/pre_config.php';
include __DIR__ . '/../../../config/config.php';
include PERCH_CORE . '/inc/loader.php';
$Perch = PerchAdmin::fetch();
include PERCH_CORE . '/inc/auth.php';
if (!$CurrentUser->has_priv('perch.settings')) {
    PerchUtil::redirect(PERCH_LOGINPATH);
}
$Perch->page_title = PerchLang::get('Settings');
$Alert = new PerchAlert();
if (isset($_GET['extended'])) {
    include __DIR__ . '/../modes/diagnostics.extended.pre.php';
} else {
    include __DIR__ . '/../modes/diagnostics.pre.php';
}
include __DIR__ . '/../modes/diagnostics.pre.php';
include PERCH_CORE . '/inc/top.php';
if (isset($_GET['extended'])) {
    include __DIR__ . '/../modes/diagnostics.extended.post.php';
} else {
    include __DIR__ . '/../modes/diagnostics.post.php';
}
include PERCH_CORE . '/inc/btm.php';
Exemple #27
0
<?php

include realpath(__DIR__ . '/../../../../..') . '/inc/pre_config.php';
include realpath(__DIR__ . '/../../../../../..') . '/config/config.php';
include PERCH_CORE . '/inc/loader.php';
$Perch = PerchAdmin::fetch();
include PERCH_CORE . '/inc/auth.php';
if (!PERCH_RUNWAY) {
    exit;
}
$Perch->page_title = PerchLang::get('Collection');
$app_path = PERCH_CORE . '/apps/content';
include $app_path . '/PerchContent_Item.class.php';
include $app_path . '/PerchContent_Items.class.php';
include $app_path . '/PerchContent_Page.class.php';
include $app_path . '/PerchContent_Pages.class.php';
include $app_path . '/PerchContent_Region.class.php';
include $app_path . '/PerchContent_Regions.class.php';
include PERCH_CORE . '/runway/apps/content/PerchContent_Collections.class.php';
include PERCH_CORE . '/runway/apps/content/PerchContent_Collection.class.php';
include PERCH_CORE . '/runway/apps/content/PerchContent_CollectionItems.class.php';
include PERCH_CORE . '/runway/apps/content/PerchContent_CollectionItem.class.php';
include PERCH_CORE . '/runway/apps/content/modes/collection.edit.pre.php';
include PERCH_CORE . '/inc/top.php';
include PERCH_CORE . '/runway/apps/content/modes/collection.edit.post.php';
include PERCH_CORE . '/inc/btm.php';
Exemple #28
0
}
echo $Form->text('tags', $Form->get(array('tags' => $edit_str), 'tags'), '', false, 'text', 'data-tags="/core/apps/assets/async/tags.php"');
?>
            <?php 
echo $Form->hint(PerchLang::get('Complete each tag with a comma.'));
?>
        </div>
        <div class="field checkboxes">
            <?php 
echo $Form->label('resourceInLibrary', 'Mark as a library asset');
?>
            
            <?php 
echo $Form->checkbox('resourceInLibrary', '1', $Form->get($details, 'resourceInLibrary'));
?>
            <?php 
echo $Form->hint(PerchLang::get('Library assets are kept, even if unused.'));
?>
        </div>



        <p class="submit">
            <?php 
echo $Form->submit('btnsubmit', 'Submit', 'button');
?>
        </p>
        
	</form>
<?php 
include PERCH_PATH . '/core/inc/main_end.php';
Exemple #29
0
        <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>

    <?php 
}
?>

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


    <?php 
/* ----------------------------------------- /SMART BAR ----------------------------------------- */
Exemple #30
0
<?php

include __DIR__ . '/../../../../inc/pre_config.php';
include __DIR__ . '/../../../../../config/config.php';
include PERCH_CORE . '/inc/loader.php';
if (!PERCH_RUNWAY) {
    PerchUtil::redirect(PERCH_LOGINPATH . '/core/settings/');
}
$Perch = PerchAdmin::fetch();
include PERCH_CORE . '/inc/auth.php';
if (!$CurrentUser->has_priv('perch.settings')) {
    PerchUtil::redirect(PERCH_LOGINPATH);
}
$Perch->page_title = PerchLang::get('Restore Backup');
$Alert = new PerchAlert();
$app_path = __DIR__ . '/../../..';
include PERCH_CORE . '/runway/settings/inc/backup.php';
include PERCH_CORE . '/runway/settings/modes/backup.general.restore.pre.php';
include PERCH_CORE . '/inc/top.php';
include PERCH_CORE . '/runway/settings/modes/backup.general.restore.post.php';
include PERCH_CORE . '/inc/btm.php';