protected function getActions() { $html = ''; foreach ($this->options['actions'] as $value) { $html .= parent::replaceWraper(2, array($this->options['item_class'], $this->{$value}), $this->options['item_wrap']); } return $html; }
function lx($id = null) { App::import('Helper', 'Base'); $base = new BaseHelper(); $id = $base->decode($id); if (!$id) { $this->Session->setFlash('Invalid URL'); $this->redirect(array('action' => 'index'), null, true); } $this->data = $this->Link->findById($id, array('recursive' => false)); if (!$this->data) { $this->Session->setFlash('Invalid URL'); $this->redirect(array('action' => 'index'), null, true); } $log = ClassRegistry::init('Log'); $log->create(array('link_id' => $id, 'referrer' => $this->referer(), 'address' => $this->RequestHandler->getClientIP())); $log->save(); header('Location: ' . $this->data['Link']['url']); }
public function Eliminar($id) { try { $this->Link->prepare("DELETE FROM categoria WHERE id = ?")->execute(array($id)); $this->rh->SetResponse(true); } catch (Exception $e) { BaseHelper::ELog($e); } return $this->rh; }
public function Eliminar($idCarrito, $id) { try { $this->Link->prepare("DELETE FROM pedido_has_producto WHERE producto_idproducto = ? AND pedido_idPedido = ?")->execute(array($id, $idCarrito)); $this->rh->SetResponse(true); } catch (Exception $e) { BaseHelper::ELog($e); } return $this->rh; }
public function Registrar($file) { $_ext = explode('.', $file['name']); $_nombre = date('ymdhis') . '.' . $_ext[count($_ext) - 1]; move_uploaded_file($file['tmp_name'], _BASE_FOLDER_ . 'uploads\\' . $_nombre); try { $db = $this->Link->prepare("INSERT INTO archivo(Nombre, Tipo, Peso, Fecha)\n\t\t\t \t\t\t VALUES(?, ?, ?, ?)\n\t\t\t \t"); $db->execute(array($_nombre, BaseHelper::TipoDeArchivo($file['type']), $file['size'], BaseHelper::GetDateTime())); $this->rh->SetResponse(true); } catch (Exception $e) { BaseHelper::ELog($e); } return $this->rh; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $params = Input::get(); $products_d = Product::where('updated_at', '<', date('Y-m-d H:i:s')); foreach ($params as $key => $value) { if ($key != 'page') { $field = ucfirst($key); $field = str_replace('_', '', $field); $searchClass = "Search" . $field . "Product"; $products_d = $searchClass::searchField($key, $value); } } $products = $products_d->orderBy('created_at', 'desc')->paginate(BaseHelper::getItemPerPage()); if (array_key_exists('user', $params)) { $view = View::make('frontend/products/user-products')->with('products', $products)->with('u_name', User::find($products['user_id'])->name); } else { $view = View::make('frontend/products/index')->with('products', $products); } return $view; }
public function Categorias() { $this->Layout = false; $this->Attach['action'] = $_REQUEST['action']; if ($this->Attach['action'] == 'listar') { $this->Attach['Categorias'] = $this->cm->Listar(); $this->Attach['Relaciones'] = $_REQUEST['entrada_id'] > 0 ? $this->cm->Relaciones($_REQUEST['entrada_id']) : array(); $this->LoadView(); } if ($this->Attach['action'] == 'ver') { $this->Attach['Categoria'] = $this->cm->Obtener($_REQUEST['id']); $this->LoadView(); } if ($this->Attach['action'] == 'registrar') { echo json_encode($this->cm->Registrar(BaseHelper::ParseRequestParameterToEntity(BaseHelper::GetEntity('categoria'), $_POST))); } if ($this->Attach['action'] == 'actualizar') { echo json_encode($this->cm->Actualizar(BaseHelper::ParseRequestParameterToEntity(BaseHelper::GetEntity('categoria'), $_POST))); } if ($this->Attach['action'] == 'eliminar') { echo json_encode($this->cm->Eliminar($_REQUEST['id'])); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { // $products = Product::orderBy('created_at', 'desc')->paginate(BaseHelper::getItemPerPage()); return View::make('backend.product.index')->with('products', $products); }
<?php /** * Filemanager PHP connector * Initial class, put your customizations here * * @license MIT License * @author Riaan Los <mail (at) riaanlos (dot) nl> * @author Simon Georget <simon (at) linea21 (dot) com> * @author Pavel Solomienko <https://github.com/servocoder/> * @copyright Authors */ // only for debug // error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); // ini_set('display_errors', '1'); require_once 'BaseHelper.php'; function auth() { // IMPORTANT : by default Read and Write access is granted to everyone. // You can insert your own code over here to check if the user is authorized. // If you use a session variable, you've got to start the session first (session_start()) return true; } $fm = BaseHelper::getInstance(); // use to setup files root folder //$fm->setFileRoot('userfiles', true); $fm->handleRequest();
if ((int) $_params->get('item_date_display', 1) == 1) { ?> <span class="related-item-date"><?php echo JHtml::date($item->created, 'd.m.Y'); ?> </span> <?php } ?> <h3 class="related-item-title"> <a href="<?php echo $item->link; ?> " <?php echo BaseHelper::parseTarget($_params->get('item_link_target')); ?> > <?php echo $item->title; ?> </a> </h3> <?php if ((int) $_params->get('item_date_display', 1) == 2) { ?> <div class="related-item-date"><i class="fa fa-clock-o"></i><?php echo JHtml::date($item->created, 'd.m.Y'); ?> </div>
<?php } } ?> </ul> <?php if ($options->show_all_items == 1) { ?> <div class="view-all"> <a href="<?php echo $cat->link; ?> " <?php echo BaseHelper::parseTarget($options->target); ?> ><?php echo $options->view_all_text; ?> </a> </div> <?php } ?> </div> <?php } ?>
<?php require_once "config.php"; require_once 'helper.php'; $helper = new BaseHelper(); $stmt = $db->query("select id,status_id,via,screen_name,entry,source,published_at from statuses order by created_at desc limit 100"); ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>pfilter</title> <link href="/css/main.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/scaffold.css" media="screen" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper"> <div id="contents"> <h1>Listing statuses</h1> <table> <?php $i = 0; while ($s = $stmt->fetch(PDO::FETCH_ASSOC)) { $i++; $class = $i % 2 == 0 ? 'cycle_a' : 'cycle_b'; ?> <tr class="<?php echo $class; ?> "> <td rowspan='3'><?php
public static function getList(&$_params) { $db = JFactory::getDbo(); // Get an instance of the generic articles model $articles = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); // Set application parameters in model $articles->setState('list.select', 'a.id, a.title, a.alias, a.introtext, a.fulltext, ' . 'a.checked_out, a.checked_out_time, ' . 'a.catid, a.created, a.created_by, a.created_by_alias, ' . 'CASE WHEN a.modified = ' . $db->q($db->getNullDate()) . ' THEN a.created ELSE a.modified END as modified, ' . 'a.modified_by, uam.name as modified_by_name,' . 'CASE WHEN a.publish_up = ' . $db->q($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END as publish_up,' . 'a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, ' . 'a.hits, a.xreference, a.featured'); $app = JFactory::getApplication(); $appParams = $app->getParams(); $articles->setState('params', $appParams); // Set the filters based on the module params $articles->setState('list.start', 0); $articles->setState('list.limit', (int) $_params->get('count', 0)); $articles->setState('filter.published', 1); // Access filter $access = !JComponentHelper::getParams('com_content')->get('show_noauth'); $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id')); $articles->setState('filter.access', $access); // Category filter $catids = $_params->get('depends'); if ($catids != null) { if ($_params->get('show_child_category_articles', 0) && (int) $_params->get('levels', 0) > 0) { // Get an instance of the generic categories model $categories = JModelLegacy::getInstance('Categories', 'ContentModel', array('ignore_request' => true)); $categories->setState('params', $appParams); $levels = $_params->get('levels', 1) ? $_params->get('levels', 1) : 9999; $categories->setState('filter.get_children', $levels); $categories->setState('filter.published', 1); $categories->setState('filter.access', $access); $additional_catids = array(); foreach ($catids as $catid) { $categories->setState('filter.parentId', $catid); $recursive = true; $items = $categories->getItems($recursive); if ($items) { foreach ($items as $category) { $condition = $category->level - $categories->getParent()->level <= $levels; if ($condition) { $additional_catids[] = $category->id; } } } } $catids = array_unique(array_merge($catids, $additional_catids)); } $articles->setState('filter.category_id', $catids); // Ordering $articles->setState('list.ordering', $_params->get('article_ordering', 'a.ordering')); $articles->setState('list.direction', $_params->get('article_ordering_direction', 'ASC')); // // New Parameters $articles->setState('filter.featured', $_params->get('show_front', 'show')); // Filter by language $articles->setState('filter.language', $app->getLanguageFilter()); $items = $articles->getItems(); //$show_introtext = $_params->get('show_introtext', 0); //$introtext_limit = $_params->get('introtext_limit', 100); $title_limit = $_params->get('item_title_max_characs', 20); // Find current Article ID if on an article page $option = $app->input->get('option'); $view = $app->input->get('view'); if ($option === 'com_content' && $view === 'article') { $active_article_id = $app->input->getInt('id'); } else { $active_article_id = 0; } // Prepare data for display using display options foreach ($items as &$item) { $item->slug = $item->id . ':' . $item->alias; $item->catslug = $item->catid ? $item->catid . ':' . $item->category_alias : $item->catid; if ($access || in_array($item->access, $authorised)) { // We know that user has the privilege to view the article $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug)); } else { $app = JFactory::getApplication(); $menu = $app->getMenu(); $menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login'); if (isset($menuitems[0])) { $Itemid = $menuitems[0]->id; } elseif ($app->input->getInt('Itemid') > 0) { // Use Itemid from requesting page only if there is no existing menu $Itemid = $app->input->getInt('Itemid'); } $item->link = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $Itemid); } // Used for styling the active article $item->active = $item->id == $active_article_id ? 'active' : ''; $item->title = BaseHelper::truncate($item->title, $title_limit); //if ($show_introtext) { // $item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'plg_content_relatednews.content'); // self::getImages($item, $_params); // $item->introtext = self::_cleanIntrotext($item->introtext); //} else { $item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'plg_content_relatednews.content'); BaseHelper::getArticleImages($item, $_params); //} //$item->displayIntrotext = $show_introtext ? self::truncate($item->introtext, $introtext_limit) : ''; //$item->displayReadmore = $item->alternative_readmore; } return $items; } }
public function Lectura($id) { try { $this->Link->prepare("UPDATE entrada SET Lectura = (Lectura + 1) WHERE id = ?")->execute(array($id)); $this->rh->SetResponse(true); } catch (Exception $e) { BaseHelper::ELog($e); } return $this->rh; }
</div> </div> <div class="panel-heading">Archivos Adjuntos</div> <div style="max-height:200px;overflow-y:auto;"> <ul class="list-group"> <?php foreach ($this->Attach['Archivos'] as $a) { ?> <?php if ($a->Tipo == 2) { ?> <li class="list-group-item"><?php echo $this->BaseUrl('uploads/' . $a->Nombre); ?> <span class="badge badge-default"><?php echo BaseHelper::GetFileSize($a->Peso); ?> </span></li> <?php } ?> <?php } ?> </ul> </div> </div> </div> <script> function __RefrescarArchivos()