Пример #1
0
function getSingleProductById($id, $db)
{
    $stmt = $db->prepare('SELECT ' . 'products.product_id,' . 'products.product_name, ' . 'products.product_description, ' . 'products.product_google_description, ' . 'products.product_price, ' . 'products.product_image_path,' . 'products.product_start, ' . 'products.product_end, ' . 'products.product_status, ' . 'products.product_valence, ' . 'products.product_brand, ' . 'product_has_category.category_id, ' . 'categories.category_name, ' . 'product_has_subcategory.subcategory_id, ' . 'subcategories.subcategory_name, ' . 'GROUP_CONCAT(product_has_properties.product_has_properties_id) AS product_has_properties_id, ' . 'GROUP_CONCAT(product_has_properties.properties_id) AS properties_id, ' . 'GROUP_CONCAT(product_has_properties.property_value) AS property_value, ' . 'GROUP_CONCAT(properties.property_name) AS property_name, ' . 'phv.product_visits ' . 'FROM user_has_products ' . 'JOIN products ON products.product_id = user_has_products.product_id ' . 'JOIN product_has_category ON product_has_category.product_id = products.product_id ' . 'JOIN product_has_subcategory ON product_has_subcategory.product_id = products.product_id ' . 'LEFT JOIN product_has_visits AS phv ON products.product_id = phv.product_id ' . 'JOIN categories ON categories.category_id = product_has_category.category_id ' . 'JOIN subcategories ON subcategories.subcategory_id = product_has_subcategory.subcategory_id ' . 'JOIN product_has_properties ON product_has_properties.product_id = products.product_id ' . 'JOIN properties ON properties.property_id = product_has_properties.properties_id ' . 'WHERE products.product_id = ' . $id . ' GROUP BY products.product_id');
    if ($stmt !== false) {
        $stmt->execute();
        $result = $stmt->fetch(PDO::FETCH_ASSOC);
        if (!empty($result)) {
            if (is_dir($result['product_image_path']) && ($pp = opendir($result['product_image_path']))) {
                while (($file = readdir($pp)) !== false) {
                    if ($file != "." && $file != "..") {
                        $img[] = $file;
                    }
                }
                closedir($pp);
            }
            if (!isset($img)) {
                $result['product_images'][0] = false;
            } else {
                $result['product_images'] = $img;
            }
            $result['category_name_url'] = toUrl($result['category_name']);
            $result['product_name_url'] = toUrl($result['product_name']);
            $result['subcategory_name_url'] = toUrl($result['subcategory_name']);
            return $result;
        } else {
            return false;
        }
    }
    return false;
}
Пример #2
0
 public function logout()
 {
     $this->setLog('用户退出');
     session_destroy();
     unset($_SESSION);
     toUrl('LOGIN');
     exit;
 }
Пример #3
0
        for ($j = 0; $j < $kar['addTimeNum']; $j++) {
            echo '<option value="' . $kar['addTime'][$j] . '">' . $kar['addTime'][$j] / $kar['addTime'][0] . '</option>
              ';
        }
        echo '
		    </select>&nbsp;
            ' . $testo['common']['commDays'] . '
            <input name="id" type="hidden" value="' . $array['id'][$i] . '"/>
            <input name="remTime" type="hidden" value="' . $extra['remTime'] . '"/>
            <button name="ACT" type="submit" value="' . $testo['buttons']['addRemTime'] . '">
               ' . $testo['buttons']['addRemTime'] . '
            </button>
		</form>
        ';
        $uar['pag'] = 'setGrants';
        toUrl();
        echo '
   		<form action="index.php?token=' . $var['token'] . '" name="clrTxT" method="post">
            <input name="id" type="hidden" value="' . $array['id'][$i] . '"/>
            <input name="token" type="hidden" value="' . $_GET['token'] . '"/>
            <button name="ACT" type="submit" value="' . $testo['buttons']['setGrants'] . '">
               ' . $testo['buttons']['setGrants'] . '
            </button>
		</form>
		<form action="index.php?token=' . $_GET['token'] . '" name="clrTxT" method="post">
            ' . $testo['common']['deleteSure'] . '
            &nbsp;
            <input type="checkbox" value="delSure" id="delSure" name="delSure" />
            &nbsp;
            <input name="id" type="hidden" value="' . $array['id'][$i] . '"/>
            <button name="ACT" type="submit" value="' . $testo['buttons']['delUser'] . '">
Пример #4
0
    </div>
    
    <?php 
if (count($activeEnlaces) > 0) {
    ?>
      <div id="external-links">
        <h3><?php 
    echo __('Enlaces externos');
    ?>
</h3>
        <ul>
          <?php 
    foreach ($activeEnlaces as $enlace) {
        ?>
    	      <li><?php 
        echo link_to(toShownUrl(urldecode($enlace->getUrl())), toUrl($enlace->getUrl()));
        ?>
</li>
          <?php 
    }
    ?>
        </ul>
      </div>
    <?php 
}
?>
    
    <div id="etiquetas">
      <?php 
include_partial('global/etiquetas', array('entity' => $partido));
?>
Пример #5
0
<div class="panel panel-primary">
	<?php 
if ($heading) {
    echo '<div class="panel-heading"><strong>' . $heading . '</strong></div>';
}
?>
	<div class="list-group">
		<?php 
foreach ($list as $text) {
    echo '<a href="' . toUrl($text) . '" class="list-group-item';
    if (preg_match('/^!/', $text)) {
        $text = preg_replace('/^!/', '', $text);
        echo ' list-group-item-success"><strong>' . $text . '</strong></a>';
    } else {
        echo '">' . $text . '</a>';
    }
}
?>
	</div>
</div>
Пример #6
0
                                    <div class="google-window">
                                        <a class="main-title"><span class="g-product-name"><?php 
            echo $products[0]['product_name'];
            ?>
</span> - <span>Möbel Mafia</span></a>
                                        <p class="g-url"><?php 
            echo $_SERVER['HTTP_HOST'];
            ?>
<span class="g-category"><?php 
            echo toUrl($products[0]['category_name']);
            ?>
</span><span class="g-subcategory"><?php 
            echo toUrl($products[0]['subcategory_name']);
            ?>
</span><span class="g-product"><?php 
            echo toUrl($products[0]['product_name']);
            ?>
</span></p>
                                        <p class="g-description"><?php 
            echo $products[0]['product_google_description'];
            ?>
</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <hr>
                        <div class="form-group">
                        <div class="row">
                            <script src="//cdn.jsdelivr.net/webshim/1.14.5/polyfiller.js"></script>
                            <script>
Пример #7
0
    ?>
          	<?php 
    if ($form['enlace_n4']['url']->getValue()) {
        ?>
    		      <li><?php 
        echo link_to(toShownUrl(urldecode($form['enlace_n4']['url']->getValue())), toUrl($form['enlace_n4']['url']->getValue()));
        ?>
</li>
          	<?php 
    }
    ?>
          	<?php 
    if ($form['enlace_n5']['url']->getValue()) {
        ?>
    		      <li><?php 
        echo link_to(toShownUrl(urldecode($form['enlace_n5']['url']->getValue())), toUrl($form['enlace_n5']['url']->getValue()));
        ?>
</li>
          	<?php 
    }
    ?>
          </ul>
      	<?php 
}
?>
      </div>
    </div>

  </div>
</div>
Пример #8
0
include "./common/common.php";
$getData = checkData($_GET);
$actionModule = $getData['action'] != '' ? strtolower($getData['action']) . 'Action' : '';
//print_r($actoin);die;
if ($actionModule) {
    $actionFile = ACTION_DIR . $actionModule . '.class.php';
    if (!file_exists($actionFile)) {
        toUrl('ERROR', $actionModule . '类文件不存在');
    }
    include $actionFile;
    $act = new $actionModule();
    $func = empty($getData['opt']) ? 'index' : $getData['opt'];
    if (!method_exists($act, $func)) {
        toUrl('ERROR', $getData['action'] . '->' . $func . '方法不存在');
    }
    if (in_array($getData['opt'], array('login', 'logout', 'error')) || $act->chkGrant()) {
        $act->{$func}();
        $smarty->display(strtolower($getData['action']) . "/" . $func . ".html");
    } else {
        toUrl('ERROR', '没有权限,非法访问');
    }
} else {
    //首页
    if ($_SESSION['uId'] < 1) {
        toUrl('LOGIN');
    }
    include ACTION_DIR . 'sysAction.class.php';
    $act = new sysAction();
    $act->index();
    $smarty->display('index.html');
}
Пример #9
0
?>
">
				<span class="glyphicon glyphicon-home"></span>
			</a>
		</li>
    	<?php 
foreach ($this->config->item('navigation')['middle'] as $groupText => $group) {
    echo '<li>';
    if (is_array($group)) {
        echo '<a href="#" class="dropdown-toggle" data-toggle="dropdown"><strong>';
        echo $groupText;
        echo '</strong><span class="glyphicon glyphicon-option-horizontal"></span></a>';
        echo '<ul class="dropdown-menu">';
        $firstLink = true;
        foreach ($group as $text) {
            if ($firstLink) {
                $firstLink = false;
            } else {
                echo '<li role="separator" class="divider"></li>';
            }
            echo '<li class="text-center"><a href="' . toUrl($text) . '">' . $text . '</a></li>';
        }
        echo '</ul>';
    } else {
        echo '<a href="' . $group . '">' . $groupText . '</a>';
    }
    echo '</li>';
}
?>
		</ul>
	</div>
Пример #10
0
 public function update()
 {
     $item = new Item($this->db);
     if ($this->f3->exists('POST.update')) {
         $item->edit($this->f3->get('POST.tok'));
         //get id getIdByTok
         $getIdByTok = new Item($this->db);
         $getIdByTok->getIdByTok($this->f3->get('POST.tok'));
         $iid = $this->f3->get('ID.id');
         //del tags
         $tgs = new Tag2Item($this->db);
         $tgs->getByItemId($iid);
         if (count($tgs->getByItemId($iid)) > 0) {
             foreach ($tgs->getByItemId($iid) as $t) {
                 $itemid = $t['id'];
                 $delti = new Tag2Item($this->db);
                 $delti->delete($itemid);
             }
         }
         //update tags
         $tags = explode(',', $this->f3->get('POST.tags'));
         foreach ($tags as $t) {
             $t = trim($t);
             if ($t != '') {
                 $this->f3->clear('TAGS');
                 $ifexists = new Tag($this->db);
                 $ifexists->getByName(strtolower($t));
                 if ($this->f3->exists('TAGS.id')) {
                     $tid = $this->f3->get('TAGS.id');
                 } else {
                     //insert new tag
                     $newtag = new Tag($this->db);
                     $newtag->title = strtolower(preg_replace('|[^0-9a-z \\-\\/+]|', '', $t));
                     $newtag->label = preg_replace('|[^0-9A-Za-z \\-\\/+]|', '', $t);
                     $newtag->url = toUrl($t);
                     //get unique tok
                     $utok = new Tag($this->db);
                     $randtok = rand(100000000, 999999999);
                     while ($utok->tagcountByTok($randtok) > 0) {
                         $randtok = rand(100000000, 999999999);
                     }
                     $newtag->tok = $randtok;
                     $newtag->add();
                     $tid = $newtag->_id;
                 }
                 //add to Tag2Item
                 $t2i = new Tag2Item($this->db);
                 //insert lastinsertedid
                 $t2i->tid = $tid;
                 $t2i->iid = $iid;
                 $t2i->add();
             }
         }
         $this->f3->set('COOKIE.message', 'The bookmark has been successfully saved!');
         $this->f3->set('COOKIE.messagetype', 'alert-success hide5s');
         $this->f3->reroute('/');
     } else {
         $item->getById($this->f3->get('PARAMS.tok'));
         $this->f3->set('item', $item);
         $this->f3->set('active', $this->f3->get('PARAMS.tok'));
         $this->f3->set('page_head', 'Update Item');
         //template
         $this->f3->set('view', 'item/update.htm');
         $tgs = new TagList($this->db);
         $this->f3->set('tgs', $tgs->getitemtags($this->f3->get('POST.tok')));
         $this->f3->set('ctrcount', count($tgs->getitemtags($this->f3->get('POST.tok'))));
         //menu
         $this->f3->set('topmenu', 'i');
         //breadcrumbs
         $this->f3->set('breadcrumb', array(array("url" => NULL, "name" => "Update bookmark")));
     }
 }
Пример #11
0
 public function update()
 {
     $tg = new Tag($this->db);
     if ($this->f3->exists('POST.update')) {
         $this->f3->set('POST.url', toUrl($this->f3->get('POST.title')));
         $this->f3->set('POST.title', preg_replace('|[^0-9A-Za-z\\-\\/+]|', '', $this->f3->get('POST.title')));
         $this->f3->set('POST.label', preg_replace('|[^0-9A-Za-z\\-\\/+]|', '', $this->f3->get('POST.label')));
         $tg->edit($this->f3->get('POST.tok'));
         $this->f3->set('COOKIE.message', 'The tag has been successfully saved!');
         $this->f3->set('COOKIE.messagetype', 'alert-success hide5s');
         $this->f3->reroute('/t');
     } else {
         $tg->getById($this->f3->get('PARAMS.tok'));
         $this->f3->set('tags', $tg);
         $this->f3->set('header', 'Update Tag');
         //template
         $this->f3->set('view', 'tags/update.htm');
         //menu
         $this->f3->set('topmenu', 't');
         //breadcrumbs
         $this->f3->set('breadcrumb', array(array("url" => "/t", "name" => "Tags"), array("url" => NULL, "name" => "Update Tag")));
     }
 }
Пример #12
0
function _autolink_create_html_tags(&$value, $key, $other = null)
{
    $target = $nofollow = null;
    if (is_array($other)) {
        //$target      =  ( $other['target']   ? " target=\"$other[target]\"" : null );
        // see: http://www.google.com/googleblog/2005/01/preventing-comment-spam.html
        $nofollow = $other['nofollow'] ? ' rel="nofollow"' : null;
    }
    $value = "<a href=\"" . toUrl($key) . "\"{$target}{$nofollow}>" . toShownUrl($key) . "</a>";
}
Пример #13
0
 public function update()
 {
     $category = new Cat($this->db);
     if ($this->f3->exists('POST.update')) {
         $uurl = toUrl($this->f3->get('POST.name'));
         //check if the category already exists
         //if not unique name
         $uname = new Cat($this->db);
         if ($uname->catcountByUrl($uurl) > 0) {
             $this->f3->set('COOKIE.message', 'The category name already exists!');
             $this->f3->set('COOKIE.messagetype', 'alert-danger hide10s');
             $this->f3->reroute('/c/update/' . $this->f3->get('POST.tok'));
         }
         $this->f3->set('POST.url', toUrl($this->f3->get('POST.name')));
         $this->f3->set('POST.name', preg_replace('|[^0-9A-Za-z\\-\\/+]|', '', $this->f3->get('POST.name')));
         $category->edit($this->f3->get('POST.tok'));
         $this->f3->set('COOKIE.message', 'Category has been successfully saved!');
         $this->f3->set('COOKIE.messagetype', 'alert-success hide5s');
         $this->f3->reroute('/c');
     } else {
         $category->getById($this->f3->get('PARAMS.tok'));
         $this->f3->set('categoires', $category);
         $this->f3->set('header', 'Update Category');
         $this->f3->set('view', 'cats/update.htm');
         //menu
         $this->f3->set('topmenu', 'c');
         //breadcrumbs
         $this->f3->set('breadcrumb', array(array("url" => "/c", "name" => "Categories"), array("url" => NULL, "name" => "Update Category")));
     }
     //display messages (if not empty) and clear values
     if ($this->f3->get('COOKIE.message')) {
         $this->f3->set('message', $this->f3->get('COOKIE.message'));
         $this->f3->set('COOKIE.message', '');
     }
     if ($this->f3->get('COOKIE.messagetype')) {
         $this->f3->set('messagetype', $this->f3->get('COOKIE.messagetype'));
         $this->f3->set('COOKIE.messagetype', '');
     }
 }