?> "> <i class="icon"><img src="images/admin/members.png" width="16px"></i> Search users </a> </li> </ul> </li> <li class="item"><a href="#" class="menu" rel="admin_addons">Addons</a> <ul class="dropdown" id="admin_addons"> <li class="title"><a>Installed addons</a></li> <?php $addons = makefilelist(PATH_APPLICATIONS, ".|..|index.html", true, "folders"); if (count($addons) > 0) { foreach ($addons as $addon) { $add = new Addon($addon); if ($add->isInstalled() && $add->hasAdmin()) { ?> <li> <a href="<?php echo page("admin", "addons", "admin", $addon); ?> "> <i class="icon"><img src="images/admin/addons.png" width="16px"></i> <?php echo ucfirst($addon); ?> </a> </li> <?php } } } else {
/** * Is a given $addon installed? * * @param string $addon Name of the addon to look up * @return boolean */ public function isInstalled($addon) { return Addon::isInstalled($addon); }
$db->nextRecord(); $group = $db->group_name; $installed = get_date($db->addon_added); } else { $group = ""; $installed = ""; } ?> <tr> <td class="border-bottom"><?php echo $addon; ?> </td> <td class="border-bottom border-right" align="right"> <?php if ($app->isInstalled()) { ?> <?php if ($app->hasAdmin()) { ?> <a href="<?php echo page("admin", "addons", "admin", $addon); ?> " class="rel" title="Admin"><img src="images/icons/admin_16.png" /></a> <?php } ?> <a href="<?php echo page("admin", "addons", "edit", $addon); ?> " class="rel" title="Edit"><img src="images/icons/edit_16.png" /></a>
<?php try { if (!$this->addon) throw new Exception("missing data"); $addon = new Addon($this->addon); if (!$addon->checkInstall()) throw new Exception("addons is not installable"); if ($addon->isInstalled()) throw new Exception("addon is already installed"); if (isset($_POST['install'])) { try { if ($_POST['secure_input'] != $_SESSION['secure_token']) throw new Exception("Wrong secured token"); $addon->Install(); $db = new DB("addons"); $db->setColPrefix("addon_"); $db->name = $this->addon; $db->installed = true; $db->added = time(); $db->group = $_POST['group']; $db->insert(); header("location: ".page("admin", "addons"), true); } Catch (Exception $e) { echo error(_t($e->getMessage())); }