<h1>Create blog entry</h1> <?php if ($submitted && Messaging::has_messages()) { Messaging::display_messages(); } ?> <form method="post" action="<?php echo PathMap::build_path('blog', 'create'); ?> "> <?php if ($submitted && is_numeric($_POST['id'])) { ?> <input type="hidden" name="id" value="<?php echo $_POST['id']; ?> " /> <?php } ?> <div style="padding: 2px;"> <label for="title">Title:</label> <input type="text" name="title" size="50" maxlength="100"<?php if ($submitted) { echo " value=\"{$_POST['title']}\""; } ?> /> </div> <div style="padding: 2px;"> <label for="body">Body:</label><br />
*/ if ($notFound) { ?> <h1>Not Found</h1> <p>Blog entry could not be found</p> <?php } else { ?> <h1>Update blog entry</h1> <?php if ($submitted && Messaging::has_messages()) { Messaging::display_messages(); } ?> <form method="post" action="<?php echo PathMap::build_path('blog', 'update', $blog->id); ?> "> <div style="padding: 2px;"> <label for="title">Title:</label> <input type="text" name="title" size="50" maxlength="100" value="<?php echo $blog->title; ?> " /> </div> <div style="padding: 2px;"> <label for="body">Body:</label><br /> <textarea name="body" style="width: 100%; height: 300px;"><?php echo $blog->body; ?> </textarea>
</div> <div style="padding: 2px;"> <label for="<?php echo $moduleName; ?> _newWindow"> <strong>Open in new window:</strong> </label> <input type="checkbox" value="1" name="<?php echo $moduleName; ?> _newWindow" /> </div> <div style="padding: 2px;"> <input type="submit" name="submitted" value="Add item" /> </div> </form> <?php } else { ?> <p>Menu item "<?php echo $menuItem->itemName; ?> " has been added.</p> <p><a href="<?php echo PathMap::build_path('sitemenus', 'items', 'index', $menu->id); ?> ">Return to menu items list</a></p> <?php } }
<h1>Reset password</h1> <?php if ($submitted && Messaging::has_messages()) { Messaging::display_messages(); } if (!$submitted || $submitted && Messaging::has_messages()) { ?> <p>Enter your display name or e-mail address in the field below and click submit.</p> <form method="post" action="<?php echo PathMap::build_path('users', 'forgotPassword'); ?> "> <p><label for="user">User:</label> <input type="text" size="50" maxlength="100" id="user" name="user" /></p> <p><input type="submit" value="Submit" name="submit" /></p> </form> <?php } else { ?> <p>A new password has been generated and sent the e-mail address associated with your account. You will be asked to change your password the next time you log in.</p> <p><a href="<?php echo PathMap::build_path('users', 'login'); ?> ">Return to log in page</a></p> <?php }
<h1>Core module configuration</h1> <?php if (Messaging::has_messages()) { Messaging::display_messages(); } else { Messaging::display_messages('successes'); Messaging::display_messages('warnings'); } ?> <p><strong>You must create an initial user. This user will be given the administrator role. Users with administrator role can access any areas that are enabled for the role. By default, the user module is configured so that only administrators can add users. This configuration option can be changed later</strong></p> <form method="post" action="<?php echo PathMap::build_path('fabriqinstall', 'install', 4); ?> "> <div style="padding: 2px;"> <label for="display">Display name: </label> <input type="text" name="display" id="display" size="24" maxlength="24" /><br /> <span style="font-size: 8pt;">Display names may only contain charcters, number, and the underscore character between 6 and 24 characters long.</span> </div> <div style="padding: 2px;"> <label for="email">e-mail address: </label> <input type="text" name="email" id="email" size="50" maxlength="100" /><br /> <span style="font-size: 8pt;">Must be a valid e-mail address. This e-mail address will be used when necessary to contact the user.</span> </div> <div style="padding: 2px;"> <label for="pwd">Password: </label> <input type="password" name="pwd" id="pwd" size="24" /><br /> <span style="font-size: 8pt;">Passwords must be at least 8 characters long. The user will be forced to change their password after their first log in.</span> </div>
<h1>Install complete</h1> <p>Congrats! You have just set up your Fabriq application!</p> <p>Be sure to remove the write permissions for the following directories (<code>chmod 775</code> is sufficient for most systems):</p> <ul> <li><code>sites/<?php echo FabriqStack::site(); ?> /config</code></li> <li><code>sites/<?php echo FabriqStack::site(); ?> /app/controllers</code></li> <li><code>sites/<?php echo FabriqStack::site(); ?> /app/views</code></li> </ul> <p>Now that your Fabriq app is installed, you can delete the .txt files from the root directory of your project.</p> <p><a href="<?php echo PathMap::build_path(); ?> ">Return to the Fabriq app's homepage</a></p>
/** * Build the HTML for this menu item */ public function getItemHtml($admin = false) { $html = "<li>\n"; if ($this->path != '') { $html .= "\t<a href=\""; if ($this->path[0] == '/') { $html .= call_user_func_array('PathMap::build_path', explode('/', substr($this->path, 1))); } else { $html .= $this->path; } $html .= "\""; if ($this->newWindow) { $html .= " target=\"_blank\""; } $html .= ">{$this->itemName}</a>"; } else { $html .= "\t{$this->itemName}"; } if ($admin) { $html .= " - <button onclick=\"window.location = '" . PathMap::build_path('sitemenus', 'items', 'update', $this->menu, $this->id) . "'\">Edit</button> <button onclick=\"window.location = '" . PathMap::build_path('sitemenus', 'items', 'destroy', $this->menu, $this->id) . "'\">Delete</button>"; } $html .= "\n"; if (count($this->children) > 0) { $html .= "\t\t<ul>\n"; for ($i = 0; $i < count($this->children); $i++) { $html .= $this->children[$i]->getItemHtml($admin); } $html .= "\t\t</ul>\n"; } $html .= "</li>\n"; return $html; }
?> <p style="font-size: 9pt; color: #666;"><strong>Tags:</strong> <?php for ($i = 0; $i < $blog->terms->count(); $i++) { echo $blog->terms[$i]->term; if ($i < $blog->terms->count() - 1) { echo ', '; } } } if ($isAdmin) { ?> </p> <p> <button type="button" onclick="window.location = '<?php echo PathMap::build_path('blog', 'update', $blog->id); ?> ';">Edit</button> <button type="button" onclick="window.location = '<?php echo PathMap::build_path('blog', 'destroy', $blog->id); ?> ';">Delete</button> </p> <?php } ?> <p><a href="<?php echo PathMap::build_path('blog'); ?> ">Return to blog</a></p> <?php }
$found = FabriqModules::get_var('sitemenus', 'found'); ?> <h1><?php echo Fabriq::title(); ?> </h1> <?php if ($found) { ?> <p> <a href="<?php echo PathMap::build_path('sitemenus', 'index'); ?> ">Return to menu list</a> | <a href="<?php echo PathMap::build_path('sitemenus', 'items', 'create', $menu->id); ?> ">Add menu item</a> </p> <p><?php echo $menu->description; ?> </p> <?php if (count($menu->items) > 0) { ?> <ul> <?php for ($i = 0; $i < count($menu->items); $i++) { echo $menu->items[$i]->getItemHtml(true); }
if ($taxonomyEnabled && $entry->terms->count() > 0) { ?> <p style="font-size: 9pt; color: #666;"><strong>Tags:</strong> <?php for ($i = 0; $i < $entry->terms->count(); $i++) { echo $entry->terms[$i]->term; if ($i < $entry->terms->count() - 1) { echo ', '; } } } if ($isAdmin) { ?> </p> <p> <button type="button" onclick="window.location = '<?php echo PathMap::build_path('blog', 'update', $entry->id); ?> ';">Edit</button> <button type="button" onclick="window.location = '<?php echo PathMap::build_path('blog', 'destroy', $entry->id); ?> ';">Delete</button> </p> <?php } } } else { ?> <p><strong>There are currently no blog entries available</strong></p> <?php }
/** * Update step 3 * Module updates */ protected function update_step3($continue = TRUE) { Fabriq::title('Module Updates'); global $db; // get modules and versions that are in the database $query = "SELECT `id`, `module`, `versionInstalled` FROM `fabmods_modules` ORDER BY `module`;"; $installed = $db->prepare_select($query, array('id', 'module', 'versionInstalled')); // look for updates to the installed modules in the code $available = array(); $installs = array(); for ($i = 0; $i < count($installed); $i++) { if (!array_key_exists($installed[$i]['module'], $available)) { $available[$installed[$i]['module']] = array(); } $install = "modules/{$installed[$i]['module']}/{$installed[$i]['module']}.install.php"; if (file_exists($install)) { require_once $install; eval('$installer = new ' . $installed[$i]['module'] . '_install();'); $installs[$installed[$i]['module']] = $installer; $methods = get_class_methods($installer); foreach ($methods as $method) { if (substr($method, 0, 7) == 'update_' && (str_replace('_', '.', str_replace('update_', '', $method)) > $installed[$i]['versionInstalled'] || $installed[$i]['versionInstalled'] == null)) { $available[$installed[$i]['module']][] = array('method' => $method, 'version' => str_replace('_', '.', str_replace('update_', '', $method))); } } } } if (isset($_POST['submit'])) { foreach ($available as $module => $updates) { if (count($updates) > 0) { foreach ($updates as $update) { $installs[$module]->{$update['method']}(); } } } if ($continue) { header("Location: " . PathMap::build_path('fabriqinstall', 'update', 4)); exit; } } else { FabriqModules::set_var('fabriqinstall', 'installed', $installed); FabriqModules::set_var('fabriqinstall', 'available', $available); } }
<div style="padding: 2px;"> <label for="currpwd"> Current password: <input type="password" name="currpwd" size="50" maxlength="100" id="currpwd" /> </label> </div> <div style="padding: 2px;"> <label for="newpwd"> New password: <input type="password" name="newpwd" size="50" maxlength="100" id="newpwd" /><br /> <span style="font-size: 8pt;">Passwords must be at least 8 characters long and must be different from your username and e-mail address.</span> </label> </div> <div style="padding: 2px;"> <label for="comfnewpwd"> Comfirm new password: <input type="password" name="comfnewpwd" size="50" maxlength="100" id="comfnewpwd" /> </label> </div> <div style="padding: 2px;"> <input type="submit" name="submit" value="Change password" /> </div> </form> <p> <a href="<?php echo PathMap::build_path('users', 'updateAccount'); ?> ">Update account</a> | <a href="<?php echo PathMap::build_path('users', 'myAccount'); ?> ">My account</a> </p>
?> <div style="padding: 2px;"> <label for="user"> User: <input type="text" size="50" maxlength="100" id="user" name="user" /> </label> </div> <div style="padding: 2px;"> <label for "pwd"> Password: <input type="password" size="50" maxlength="100" id="pwd" name="pwd" /> </label> </div> <div style="padding: 2px;"> <input type="submit" name="submit" id="submit" value="Log in" /> </div> <div style="padding: 2px;"> <?php if ($anyoneCanRegister) { ?> <a href="<?php echo PathMap::build_path('users', 'register'); ?> ">Sign up</a> |<?php } ?> <a href="<?php echo PathMap::build_path('users', 'forgotpassword'); ?> ">Forgot password</a> </div> </form> </fieldset>
echo $update['version']; ?> </li> <?php } ?> </ul> </li> <?php } else { ?> <li><?php echo $module; ?> - No updates available</li> <?php } } ?> </ul> </div> <div class="clearbox"></div> <form method="post" action="<?php PathMap::build_path('fabriqinstall', 'update', 3); ?> "> <p style="text-align: right;"> <input type="submit" name="submit" value="Install module updates and continue »" /> </p> </form>
<h1>Access Denied</h1> <p><strong>You do not have permission to view this page.</strong></p> <p><strong><a href="<?php echo PathMap::build_path($controller, $action); ?> ">Return to homepage</a></strong></p>
?> <h1>Delete menu?</h1> <form method="post" action="<?php echo PathMap::build_path('sitemenus', 'destroy', $menu->id); ?> "> <p>Are you sure you want to delete the menu "<?php echo $menu->menuName; ?> "?</p> <p> <input type="submit" name="submit" value="Submit" /> <button type="button" onclick="window.location = '<?php echo PathMap::build_path('sitemenus'); ?> ';">Cancel</button> </p> </form> <?php } else { ?> <h1>Menu deleted</h1> <?php Messaging::display_messages('successes'); ?> <p><a href="<?php echo PathMap::build_path('sitemenus'); ?> ">Return to menu list</a></p> <?php }
echo PathMap::build_path('sitemenus', 'items', 'index', $menus[$i]->id); ?> "><?php echo $menus[$i]->menuName; ?> </a> </td> <td><?php echo $menus[$i]->description; ?> </td> <td style="text-align: center;"><button type="button" onclick="window.location = '<?php echo PathMap::build_path('sitemenus', 'update', $menus[$i]->id); ?> ';">Edit</button></td> <td style="text-align: center;"><button type="button" onclick="window.location = '<?php echo PathMap::build_path('sitemenus', 'destroy', $menus[$i]->id); ?> ';">Delete</button></td> </tr> <?php } ?> </tbody> </table> <?php } else { ?> <p><strong>No menus have been created yet.</strong></p> <?php }
/** * Issue a server error */ public static function fabriq_error() { Fabriq::render('none'); header('Location: ' . PathMap::build_path(500)); }
<h1>Updates Complete</h1> <p>Updates are now complete.</p> <?php global $_FAPP; ?> <p><a href="<?php echo PathMap::build_path($_FAPP['cdefault'], $_FAPP['adefault']); ?> ">Return to the homepage</a></p>
public function update() { if (FabriqModules::module('roles')->requiresPermission('update blog posts', 'blog')) { $blog = FabriqModules::new_model('blog', 'Blogs'); $blog->find(PathMap::arg(2)); if ($blog->title != '' && ($blog->locked == 0 || FabriqModules::module('roles')->requiresPermission('update blog posts', 'blog'))) { Fabriq::title('Update blog entry'); if (file_exists('libs/javascript/tiny_mce/tiny_mce.js')) { FabriqLibs::js_lib('tiny_mce', 'tiny_mce'); FabriqLibs::js_lib('jquery.tinymce', 'tiny_mce'); FabriqModules::add_js('blog', 'blog'); } // determine if extension modules are enabled $pathmapEnabled = FabriqModules::enabled('pathmap'); FabriqModules::set_var('blog', 'pathmapEnabled', $pathmapEnabled); if ($pathmapEnabled) { FabriqModules::module('pathmap')->start_update('blog', 'show', $blog->id); FabriqModules::set_var('pathmap', 'pathmap_controller', 'blog'); FabriqModules::set_var('pathmap', 'pathmap_action', 'show'); FabriqModules::set_var('pathmap', 'pathmap_modpage', 'module'); } $taxonomyEnabled = FabriqModules::enabled('taxonomy'); FabriqModules::set_var('blog', 'taxonomyEnabled', $taxonomyEnabled); if ($taxonomyEnabled) { FabriqModules::module('taxonomy')->termsList('blog', $blog->db_table, $blog->id); } if (isset($_POST['submit'])) { $blog->title = trim($_POST['title']); $blog->body = trim($_POST['body']); $blog->locked = isset($_POST['locked']) && $_POST['locked'] == 1 ? 1 : 0; $blog->user = $_SESSION[Fabriq::siteTitle()]['FABMOD_USERS_userid']; if (strlen($blog->title) == '') { Messaging::message('Blog title is required'); } if (strlen($blog->body) == '') { Messaging::message('Blog body is required'); } if (!Messaging::has_messages()) { $blog->update(); FabriqModules::trigger_event($this->name, 'create', 'blog entry updated', $blog); // create map if needed if ($pathmapEnabled) { $_POST['pathmap_extra'] = $blog->id; $_POST['pathmap_wildcard'] = NULL; FabriqModules::module('pathmap')->update('blog', 'show', $blog->id); } // add taxonomy if available if ($taxonomyEnabled) { FabriqModules::module('taxonomy')->termsList('blog', $blog->db_table, $blog->id); } if (!Messaging::has_messages()) { header('Location: ' . PathMap::build_path('blog')); exit; } } FabriqModules::set_var('blog', 'submitted', true); } FabriqModules::set_var('blog', 'blog', $blog); } else { FabriqModules::set_var('blog', 'notFound', true); Fabriq::title('Blog entry not found'); } } }
<h1>My Account</h1> <h3>Welcome, <?php echo $_SESSION[Fabriq::siteTitle()]['FABMOD_USERS_displayname']; ?> </h3> <ul> <li><a href="<?php echo PathMap::build_path('users', 'changePassword'); ?> ">Change password</a></li> <li><a href="<?php echo PathMap::build_path('users', 'updateAccount'); ?> ">Update account</a></li> <li><a href="<?php echo PathMap::build_path('users', 'logout'); ?> ">Log out</a></li> </ul>
if ($submitted && Messaging::has_messages('successes')) { Messaging::display_messages('successes'); } ?> <p> <a href="<?php echo PathMap::build_path('fabriqadmin', 'roles', 'create'); ?> ">Add role</a> | <a href="<?php echo PathMap::build_path('fabriqadmin', 'roles', 'perms'); ?> ">Manage permissions</a> </p> <form method="post" action="<?php PathMap::build_path('fabriqadmin', 'roles', 'manage'); ?> "> <table border="0" style="border: solid 1px #999;" cellspacing="0"> <thead> <tr> <th style="width: 300px;">Role</th> <th>Enabled</th> </tr> </thead> <tbody> <?php for ($i = 0; $i < $roles->count(); $i++) { ?> <tr<?php if ($i % 2 == 0) {
public function updateAccount() { if (!$this->isLoggedIn()) { header('Location: ' . PathMap::build_path('users', 'login')); exit; } Fabriq::title('Update account'); $user = FabriqModules::new_model('users', 'Users'); $user->find($_SESSION[Fabriq::siteTitle()]['FABMOD_USERS_userid']); if (isset($_POST['submit'])) { $emailPattern = '/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+' . '(\\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i'; $displayPattern = '/([A-z0-9]){6,24}/'; if (!preg_match($displayPattern, $_POST['display'])) { Messaging::message("Display name is invalid"); } if (!preg_match($emailPattern, $_POST['email'])) { Messaging::message("e-mail address is invalid"); } if (!Messaging::has_messages()) { $user->display = $_POST['display']; $user->email = $_POST['email']; $user->update(); $_SESSION[Fabriq::siteTitle()]['FABMOD_USERS_displayname'] = $user->display; $_SESSION[Fabriq::siteTitle()]['FABMOD_USERS_email'] = $user->email; Messaging::message('Account has bee updated', 'success'); } FabriqModules::set_var('users', 'submitted', true); } FabriqModules::set_var('users', 'user', $user); FabriqModules::add_js('users', 'jquery.validate.min'); FabriqModules::add_js('users', 'users-updateAccount'); FabriqModules::add_css('users', 'users-admin'); }
$aPath = explode('/', $aPath); $i = 0; while ($aPath[$i] != 'fabriqinstall') { $appPath .= $aPath[$i] . '/'; $i++; } if (isset($_SESSION['FAB_INSTALL_site']) && $_SESSION['FAB_INSTALL_site'] != '') { $siteConfig = unserialize($_SESSION['FAB_INSTALL_site']); $submitted = true; foreach ($siteConfig as $key => $val) { $_POST[$key] = $val; } } ?> <form method="post" action="<?php PathMap::build_path('fabriqinstall', 'install', 2); ?> "> <label for="title">Page title <span class="required-field">*</span>: </label><input type="text" id="title" name="title" size="50" tabindex="1"<?php if ($submitted) { echo ' value="' . $_POST['title'] . '"'; } ?> /><br /> <label for="title_pos">Page title position <span class="required-field">*</span>: </label><select id="title-pos" name="title_pos" tabindex="2"> <option value="left"<?php if ($submitted && $_POST['title_pos'] == 'left') { echo ' selected="selected"'; } ?> >Left</option>
<h1>Module permissions</h1> <?php if (Messaging::has_messages('successes')) { Messaging::display_messages('successes'); } ?> <p> <a href="<?php echo PathMap::build_path('fabriqadmin', 'roles', 'manage'); ?> ">Manage roles</a> </p> <form method="post" action="<?php PathMap::build_path('fabriqadmin', 'roles', 'persm'); ?> "> <?php foreach ($modules as $module) { ?> <h3><?php echo $module->module; ?> </h3> <?php if (isset($perms->modules[$module->id])) { ?> <table> <thead> <tr> <th style="width: 300px;"> </th> <?php