function parseItems()
    {
        $items = array();
        $pattern = <<<PATTERN
{openWin\\('(/images/material-thumb/.+?)'.+?<img src="(/images/material-thumb/.+?)".+?
class="ProdName" [^>]+>(.+?)</a>}s
PATTERN;
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Ошибка при выделении элементов.");
        }
        foreach ($matches as $m) {
            $url = $this->url;
            $img = getRealUrl(basePath($this->url), $m[1]);
            $imgSmall = getRealUrl(basePath($this->url), $m[2]);
            if (preg_match('{".+"}s', $m[3], $matches) || strpos($m[3], "-") === false) {
                $name = $m[3];
                $art = "";
            } else {
                if (preg_match('{(.*?) ([^0-9]+)}s', $m[3], $mArtName)) {
                    $art = $mArtName[1];
                    $name = $mArtName[2];
                } else {
                    $art = $m[3];
                    $name = "";
                }
            }
            $items[] = array("url" => $url, "image_large" => $img, "image_small" => $imgSmall, "art" => $art, "name" => $name);
        }
        return $items;
    }
Ejemplo n.º 2
0
 /**
  * Render response body
  * @param  array      $env
  * @param  \Exception $exception
  * @return string
  */
 protected function renderBody(&$env, $exception)
 {
     $title = 'Oops! Exception detected';
     $code = $exception->getCode();
     $message = $exception->getMessage();
     $file = $exception->getFile();
     $line = $exception->getLine();
     $trace = str_replace(array('#', '\\n'), array('<div>#', '</div>'), $exception->getTraceAsString());
     $html = sprintf('<h1>%s</h1>', $title);
     $html .= '<p>Something is broken, the application could not run, Pulse has detected the following error:</p>';
     $html .= '<h2>Details</h2>';
     $html .= sprintf('<div><strong>Type:</strong> %s</div>', get_class($exception));
     if ($code) {
         $html .= sprintf('<div><strong>Code:</strong> %s</div>', $code);
     }
     if ($message) {
         $html .= sprintf('<div><strong>Message:</strong> %s</div>', $message);
     }
     if ($file) {
         $html .= sprintf('<div><strong>File:</strong> %s</div>', $file);
     }
     if ($line) {
         $html .= sprintf('<div><strong>Line:</strong> %s</div>', $line);
     }
     if ($trace) {
         $html .= '<h2>Trace</h2>';
         $html .= sprintf('<pre>%s</pre>', $trace);
     }
     return sprintf("<!doctype html><html lang=\"es\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><link rel=\"stylesheet\" href=\"" . asset('bootstrap.min.css') . "\"><link rel=\"stylesheet\" href=\"" . asset('styles.css') . "\"><title>%s</title><link rel=\"icon\" type=\"image/png\" href=\"" . asset('pulseLogo.png') . "\" /></head><body><nav class=\"navbar navbar-inverse navbar-fixed-top\"> <div class=\"container\"><div class=\"navbar-header\"><button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\"><span class=\"sr-only\">Toggle navigation</span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button><a class=\"navbar-brand\" href=\"" . basePath() . "\"><img src=\"" . asset('pulseLogo.png') . "\" width=\"25\"> PULSE Framework</a></div><div id=\"navbar\" class=\"collapse navbar-collapse\"><ul class=\"nav navbar-nav\"><li><a href=\"" . basePath() . "\">Página principal</a></li><li><a href=\"" . uri('documentationUrl') . "\">Documentation</a></li><li><a href=\"" . uri('communityUrl') . "\">Pulse Community</a></li><li><a href=\"" . uri('tutosUrl') . "\">Tutorials</a></li></ul></div></div></nav><div class=\"container\"><div class=\"starter-template\">%s</div></div><script src=\"" . asset('jquery.min.js') . "\"></script><script src=\"" . asset('bootstrap.min.js') . "\"></script></body></html>", $title, $html);
 }
    function parseItems()
    {
        $items = array();
        $pattern = '{<img src="(/photo/.+?)".+?
<b>(.+?)</b> : (.+?)</b>.+?Цена : (.+?) у.е. <br> <br>
(.+?) <br> <br> <b> Материал: </b>(.+?)<br>
<b> Цвета корпуса: </b>(.+?)<br> <b> Цвета деталей: (.*?)</b> <br>}s';
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Ошибка при выделении элементов.");
        }
        foreach ($matches as $m) {
            $item = array();
            $item["image_large"] = getRealUrl(basePath($this->url), $m[1]);
            $item["art"] = strip_tags($m[2]);
            $item["name"] = $m[3];
            $item["price"] = strip_tags($m[4]);
            $item["descr"] = strip_tags($m[5]);
            $item["material"] = $m[6];
            $item["colors"] = $m[7];
            $item["url"] = $this->url;
            $items[] = $item;
        }
        return $items;
    }
    function parseItems()
    {
        $items = array();
        $pattern = <<<PATTERN
{<tr>
<td align="center"> <h2 class="context">(.+?)</h2> </td>
<td align="center"> <span class="context">(.+?)</span> </td>
<td align="center"> <span class="context">(.+?)</span> </td>
<td align="center"> <a.+?href="(prod/zapis/[^"]+)" target="_blank">
<img.+?src="(prod/zapis/[^"]+)".+?> </a> </td>}s
PATTERN;
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Items not found.");
        }
        foreach ($matches as $m) {
            $name = trim($m[1]);
            $art = trim($m[2]);
            $size = trim($m[3]);
            $img = getRealUrl(basePath($this->url), $m[4]);
            $imgSmall = getRealUrl(basePath($this->url), $m[5]);
            $items[] = array("url" => $this->url, "image_large" => $img, "image_small" => $imgSmall, "name" => $name, "art" => $art, "size" => $size);
        }
        return $items;
    }
 function parseItems()
 {
     $items = array();
     $pattern = '{<div id="text">
       <h1>(.+?)</h1>
       <p>(.+?)</p>}s';
     $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
     if (!preg_match($pattern, $this->pageContent, $matches)) {
         return new PEAR_Error("Items not found.");
     }
     $name = strip_tags($matches[1]);
     $descr = strip_tags($matches[2]);
     $pattern = '{<img border="0" src="((images/[^"]+_)small(_[^"]+))"}s';
     if (!preg_match($pattern, $this->pageContent, $matches)) {
         $imgSmall = "";
         $img = "";
     } else {
         $imgSmall = getRealUrl(basePath($this->url), $matches[1]);
         $img = getRealUrl(basePath($this->url), $matches[2] . "big" . $matches[3]);
     }
     $pattern = '{<td><p class="pnavbar2"><b>(.+?)</b></p></td>}s';
     if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_PATTERN_ORDER)) {
         $colors = "";
     } else {
         $colors = implode(", ", $matches[1]);
     }
     $items[] = array("image_large" => $img, "image_small" => $imgSmall, "url" => $this->url, "name" => $name, "descr" => $descr, "colors" => $colors);
     return $items;
 }
    function parseItems()
    {
        $items = array();
        $pattern = <<<PATTERN
{<TABLE[^>]+>
<TR[^>]+>
<TD[^>]+> <IMG src="(resize.php\\?name=[^"]+)".+?
onclick="javascript:window\\.open\\('catalogPrev.php\\?catalogId=(\\d+)'[^"]+\\);"> </TD>
<TD[^>]+>
<h3>(.+?)</h3>
(.+?)<TABLE
}si
PATTERN;
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Items not found.");
        }
        foreach ($matches as $m) {
            $imgSmall = getRealUrl(basePath($this->url), $m[1]);
            $img = getRealUrl(basePath($this->url), "ItemImages/" . $m[2] . ".jpg");
            $art = trim($m[3]);
            $descr = trim(html_entity_decode(strip_tags($m[4])));
            $pattern = "{Размеры\\s*\\(XxYxZ\\):(.+)}s";
            if (preg_match($pattern, $descr, $mSize)) {
                $size = trim($mSize[1]);
            } else {
                $size = "";
            }
            $items[] = array("url" => $this->url, "image_large" => $img, "image_small" => $imgSmall, "descr" => $descr, "size" => $size, "art" => $art);
        }
        return $items;
    }
    function parseItems()
    {
        $items = array();
        $pattern = <<<PATTERN
{<img src='((images/catalogue/[^']+?)_s(\\.jpg))'.+?
\t\t\t<a href='(/\\?action=OnShowGood\\&ID=(.+?))'>
\t\t\t\t<b>(.+?)(\\(склад\\))*</b></a>}s
PATTERN;
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Ошибка при выделении элементов.");
        }
        foreach ($matches as $m) {
            $item = array();
            $item["image_small"] = getRealUrl(basePath($this->url), $m[1]);
            $item["image_large"] = getRealUrl(basePath($this->url), $m[2] . "_b" . $m[3]);
            $item["url"] = getRealUrl(basePath($this->url), $m[4]);
            $name = trim($m[6]);
            $art = "";
            $p = strrpos($name, " ");
            if ($p !== false && $p > 0) {
                $art = substr($name, $p + 1);
                $name = substr($name, 0, $p);
            }
            $item["name"] = $name;
            $item["art"] = $art;
            $items[] = $item;
        }
        return $items;
    }
Ejemplo n.º 8
0
function validate()
{
    $email = sanitize($_POST['email'], "email");
    $password = sanitize($_POST['password'], "string");
    $password = sha1(SALT . $password . $email);
    $sql = "select * from users where email = '" . escape($email) . "' and password = '******'";
    $query = mysql_query($sql);
    $user = mysql_fetch_array($query);
    $basePath = basePath();
    if ($user['id'] > 0) {
        $_SESSION['userid'] = $user['id'];
        $_SESSION['name'] = $user['name'];
        $_SESSION['email'] = $user['email'];
        $_SESSION['password'] = $user['password'];
        $_SESSION['points'] = $user['points'];
        if (!empty($_POST['returnurl'])) {
            $url = sanitize($_POST['returnurl'], "url");
            header("Location: {$url}");
        } else {
            header("Location: {$basePath}");
        }
    } else {
        header("Location: {$basePath}/users/login");
    }
}
Ejemplo n.º 9
0
 public function actionIndex($propertyId)
 {
     $this->updateActiveProperty($propertyId);
     $tutorial = $this->getTutorialState('guest_book');
     if ($this->access >= UserAccessTable::GUEST) {
         Yii::app()->request->redirect(basePath(''));
     }
     if (!UserAccessTable::checkUser2PropertyAccess(Yii::app()->user->getState('id'), $propertyId, UserAccessTable::BASIC_ACCESS)) {
         Yii::app()->request->redirect(basePath('app/properties'));
     }
     //check login
     if (Yii::app()->user->isGuest) {
         Yii::app()->request->redirect(basePath(''));
     }
     $this->updateActiveProperty($propertyId);
     //register js file
     Yii::app()->clientScript->registerScriptFile(basePath('js/pages/base.js'), CClientScript::POS_END);
     Yii::app()->clientScript->registerScriptFile(basePath('js/pages/baseMemberGuest.js'), CClientScript::POS_END);
     Yii::app()->clientScript->registerScriptFile(basePath('js/pages/member.js'), CClientScript::POS_END);
     //get db information
     $users2properties = User2property::model()->with('user')->findAll('propertyId=:propertyId AND access != :access', array(':propertyId' => $propertyId, ':access' => UserAccessTable::GUEST));
     $users = array();
     foreach ($users2properties as $key => $u2p) {
         $users[$key] = $this->createViewItem($u2p);
     }
     $accessList = UserAccessTable::allAccessLevels();
     $statusList = UserAccessTable::allStatuses();
     $currentUser = User2property::model()->with('user')->findByAttributes(array('propertyId' => $propertyId, 'userId' => Yii::app()->user->getState('id')));
     $this->render('index', array('users' => $users, 'accessList' => $accessList, 'tutorial' => $tutorial, 'statusList' => $statusList, 'isCanEdit' => $this->access < UserAccessTable::BASIC_ACCESS, 'propertyId' => $propertyId));
 }
Ejemplo n.º 10
0
 public function actionSubmit()
 {
     $data = array('email' => YII::app()->request->getParam('email', null), 'name' => YII::app()->request->getParam('name', null), 'message' => YII::app()->request->getParam('message', null));
     $model = new ContactusForm();
     $model->setAttributes($data);
     $isValid = $model->validate();
     $emails = array(Yii::app()->params['contactusEmail']);
     if (Yii::app()->user->isGuest) {
         if ($model->validate()) {
             $this->_send($model);
             //redirect
             Yii::app()->request->redirect(basePath('contactus/confirm'));
         } else {
             //render errors
             $this->layout = "main";
             $this->render('guest', array('email' => $data['email'], 'name' => $data['name'], 'contact' => Yii::app()->params['contactusEmail'], 'message' => $data['message'], 'errors' => $model->getErrors()));
         }
     } else {
         $model->email = Yii::app()->user->getState('email');
         if ($model->validate()) {
             $this->_send($model);
             //redirect
             Yii::app()->request->redirect(basePath('contactus/confirm'));
         } else {
             //render errors
             $this->layout = "app";
             $this->render('user', array('email' => $data['email'], 'name' => $data['name'], 'contact' => Yii::app()->params['contactusEmail'], 'message' => $data['message'], 'errors' => $model->getErrors()));
         }
     }
 }
Ejemplo n.º 11
0
 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->request->redirect(basePath(''));
     }
     $this->layout = 'app';
     $this->render('index');
 }
Ejemplo n.º 12
0
 protected function doUserCheck()
 {
     $allowUsers = array("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**");
     if (Yii::app()->user->isGuest) {
         Yii::app()->request->redirect(basePath(''));
     }
     if (!in_array(Yii::app()->user->email, $allowUsers)) {
         Yii::app()->request->redirect(basePath('app/gallery'));
     }
 }
Ejemplo n.º 13
0
 /**
  * Добавление урлов на страницы с данными в список
  */
 function addPageUrls($urls)
 {
     if (sizeof($urls) <= 0) {
         return;
     }
     foreach ($urls as $url) {
         $url = getRealUrl(basePath($this->url), $url);
         if (!in_array($url, $this->pagesUrls)) {
             $this->pagesUrls[] = $url;
         }
     }
 }
Ejemplo n.º 14
0
 public function actionEdit()
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->request->redirect(basePath(''));
     }
     if ($this->access > UserAccessTable::FULL_ACCESS) {
         Yii::app()->request->redirect(basePath(''));
     }
     $isUpload = isset($_GET['action']) ? true : false;
     $tutorial = Yii::app()->user->getState('tutorial_gallery');
     $images = $this->getImages();
     $property = Properties::model()->findByPk(Yii::app()->user->getState('property_id'));
     $this->render('edit', array('images' => $images, 'tutorial' => $tutorial, 'isUpload' => $isUpload, 'welcomeMessage' => $property->welcomeMessage));
     $this->renderPartial('deletePrint');
 }
Ejemplo n.º 15
0
 public function actionIndex()
 {
     $flag = UserAccessTable::GUEST;
     foreach ($this->properties as $property) {
         if ((int) $flag > (int) $property['access']) {
             $flag = (int) $property['access'];
         }
     }
     if ((int) $flag < (int) UserAccessTable::GUEST) {
         $this->ShowMessage = true;
         $this->render('Index');
     } else {
         Yii::app()->request->redirect(basePath(''));
     }
 }
 function parseItems()
 {
     $items = array();
     $img = "";
     $pattern = '{src="([^"]+ru/modules/catalog/admin/goods_images/[^"]+)"}si';
     if (preg_match($pattern, $this->pageContent, $matches)) {
         $img = getRealUrl(basePath($this->url), $matches[1]);
         $img = str_replace(" ", "%20", $img);
     }
     $name = "";
     $pattern = '{<td[^>]+background="images/portcapback.gif"[^>]+class=portcap>(.+?)</td>}si';
     if (preg_match($pattern, $this->pageContent, $matches)) {
         $name = trim(strip_tags($matches[1]));
     }
     $items[] = array("image_small" => $img, "image_large" => $img, "url" => $this->url, "name" => $name);
     return $items;
 }
Ejemplo n.º 17
0
 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->request->redirect(basePath(''));
     }
     $model = new Calendar();
     $tutorial = $this->getTutorialState('gallery');
     $isGuest = $this->access >= UserAccessTable::GUEST ? true : false;
     $events = $this->getLinks($isGuest);
     $users = $this->getPropertyMembers();
     $country = $this->propertyCountry;
     $adminCountry = $this->propertyAdminCountry;
     if ($country == $adminCountry) {
         $adminCountry = "THESAMEASPROPERTY";
     }
     $this->render('index', array('events' => $events, 'users' => $users, 'currentUserId' => Yii::app()->user->getState('id'), 'country' => $country . ';' . $adminCountry, 'tutorial' => $tutorial, 'propId' => $this->propertyId, 'userId' => $this->linkWithProperty->attributes['id']));
 }
    function parseItems()
    {
        $items = array();
        $pattern = <<<PATTERN
{<tr>
<td[^>]+>(\\d+)</td>
<td[^>]+> <p align="justify">(.+?)</p> </td>
<td[^>]+>(.+?)</td>
<td[^>]+>
(<table[^>]+>(.+?)</table>)*
</td>
<td[^>]+>
(<a href="#" onClick="window.open\\('([^']+)','','[^']+'\\); return false;">
<img src="(pic_small/[^"]+)" width="100"[^>]+> </a>|.+?)
</td>
</tr>
}s
PATTERN;
        //"
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Items not found.");
        }
        foreach ($matches as $m) {
            $descr = trim(strip_tags($m[2]));
            $art = trim($m[3]);
            if (isset($m[7])) {
                $img = getRealUrl(basePath($this->url), $m[7]);
            } else {
                $img = "";
            }
            if (isset($m[8])) {
                $imgSmall = getRealUrl(basePath($this->url), $m[8]);
            } else {
                $imgSmall = "";
            }
            $pattern = "{Размеры\\s*\\(XxYxZ\\):(.+)}s";
            if (preg_match($pattern, $descr, $mSize)) {
                $size = trim($mSize[1]);
            } else {
                $size = "";
            }
            $items[] = array("url" => $this->url, "image_large" => $img, "image_small" => $imgSmall, "descr" => $descr, "size" => $size, "art" => $art);
        }
        return $items;
    }
Ejemplo n.º 19
0
 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->request->redirect(basePath(''));
     }
     $tutorial = $this->getTutorialState('key_contacts');
     $property_id = Yii::app()->user->getState('property_id');
     $CategoryApi = sharedkeyApi::create('keycontactCategoryAPI');
     $categories = json_decode($CategoryApi->all('get'));
     $KeycontactApi = sharedkeyApi::create('keycontactAPI');
     $KeycontactApi->addParams(array('property_id' => $property_id, 'limit' => $this->_limit, 'offset' => $this->_offset));
     $result = json_decode($KeycontactApi->byPropertyId('get'));
     if ($result->result == false) {
         $this->render('keycontacts', array('data' => array(), 'categories' => $categories->data, 'tutorial' => $tutorial));
     } else {
         $this->render('keycontacts', array('data' => $result->data, 'categories' => $categories->data, 'tutorial' => $tutorial));
     }
 }
 function parseItems()
 {
     $items = array();
     $pattern = "{<a target=_blank\n\t\t\thref='(/card.php\\?id=[^']+)'>\n\t\t\t<img border=0 src='(\\./files/images/[^']+)'}s";
     $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
     if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_PATTERN_ORDER)) {
         return new PEAR_Error("Ошибка при выделении элементов.");
     }
     $urls = $matches[1];
     $smallImages = $matches[2];
     for ($i = 0; $i < sizeof($urls); $i++) {
         $url = getRealUrl(basePath($this->url), $urls[$i]);
         $item = $this->getItemInfo($url);
         $item["image_small"] = getRealUrl(basePath($this->url), $smallImages[$i]);
         $items[] = $item;
     }
     return $items;
 }
 function parseItems()
 {
     $items = array();
     $pattern = '{<div><a href="(zoom\\.php\\?cat=.+?)"><img src="(catimages/[^"]+)"}s';
     $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
     if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_PATTERN_ORDER)) {
         return new PEAR_Error("Ошибка при выделении элементов.");
     }
     $urls = $matches[1];
     $smallImages = $matches[2];
     for ($i = 0; $i < sizeof($urls); $i++) {
         $url = getRealUrl(basePath($this->url), $urls[$i]);
         $item = $this->getItemInfo($url);
         $item["image_small"] = getRealUrl(basePath($this->url), $smallImages[$i]);
         $items[] = $item;
     }
     return $items;
 }
Ejemplo n.º 22
0
 function config($key, $value = null)
 {
     if (is_null($value)) {
         //按照':'分隔
         $layered = explode(':', $key);
         if (empty($layered)) {
             return null;
         }
         $config = (include basePath() . '/config/' . $layered[0] . '.php');
         $tmp = $config;
         //从1开始
         for ($i = 1, $count = count($layered); $i < $count; $i++) {
             $tmp = $tmp[$layered[$i]];
         }
         return $tmp;
     }
     //@todo 设置key值的段落
 }
 function parseItems()
 {
     $items = array();
     $this->pageContent = iconv($this->getSiteEncoding(), "windows-1251", $this->pageContent);
     $pattern = "{<a href='/show_img\\.php\\?p\\[0\\]=(.+?)\\&.+?'\n\t\t\tonClick='return pop_window.+?><img src='(/zont/pics/.+?)' border=1>\n</a><br>(.+?)<br>(.+?)</td>}s";
     $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
     if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
         return new PEAR_Error("Ошибка при выделении элементов.");
     }
     foreach ($matches as $m) {
         $img = getRealUrl(basePath($this->url), "/zont/pics/" . $m[1]);
         $imgSmall = getRealUrl(basePath($this->url), $m[2]);
         $art = $m[3];
         $descr = $m[4];
         $items[] = array("url" => $this->url, "image_large" => $img, "image_small" => $imgSmall, "art" => $art, "descr" => $descr);
     }
     return $items;
 }
    function parseItems()
    {
        $items = array();
        $pattern = '{
<a href="(/index\\.php\\?page=\\d+)"> <img src="(/file\\.php\\?f=\\d+)"}s';
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_PATTERN_ORDER)) {
            return new PEAR_Error("Items not found.");
        }
        $urls = $matches[1];
        $smallImages = $matches[2];
        for ($i = 0; $i < sizeof($urls); $i++) {
            $url = getRealUrl(basePath($this->url), $urls[$i]);
            $item = $this->getItemInfo($url);
            $item["image_small"] = getRealUrl(basePath($this->url), $smallImages[$i]);
            $items[] = $item;
        }
        return $items;
    }
Ejemplo n.º 25
0
function get_page($page, $args = array())
{
    //let pages use some variables
    extract($args);
    $config = $GLOBALS['config'];
    $lang = $GLOBALS['lang'];
    $basePath = basePath();
    $themePath = $basePath . "/theme";
    $themePageInclude = "{$themePath}/{$page}.php";
    if (file_exists("{$themePath}/header.php")) {
        include "{$themePath}/header.php";
    }
    if (file_exists($themePageInclude)) {
        include $themePageInclude;
    }
    if (file_exists("{$themePath}/footer.php")) {
        include "{$themePath}/footer.php";
    }
}
    function parseItems()
    {
        $items = array();
        $pattern = '{
<td[^>]*>
<img[^>]+src="(/pic/[^"]+)"[^>]*>
</td>
}s';
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Items not found.");
        }
        foreach ($matches as $m) {
            $img = getRealUrl(basePath($this->url), $m[1]);
            $item = array("url" => $this->url, "image_large" => $img);
            $items[] = $item;
        }
        return $items;
    }
Ejemplo n.º 27
0
 public function actionPrintpart($id = false)
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->request->redirect(basePath(''));
     }
     $property_id = Yii::app()->user->getState('property_id');
     $api = sharedkeyApi::create('noticeboardAPI');
     if (!$id) {
         $api->addParams(array('property_id' => $property_id, 'limit' => $this->_limit, 'offset' => $this->_offset));
         $result = json_decode($api->byPropertyId('get'));
     } else {
         $api->addParams(array('id' => $id, 'property_id' => $property_id, 'limit' => $this->_limit, 'offset' => $this->_offset));
         $result = json_decode($api->byNoticeId('get'));
         $result->data = array($result->data);
     }
     $this->layout = 'print';
     $this->tabName = 'Notice Board';
     return $this->render('print', array('items' => $result->data), true);
 }
    function parseItems()
    {
        $items = array();
        $pattern = <<<PATTERN
{<a href="(.+?)"
\t\t\tonClick="big_win\\('nw7',880,490\\);" target="nw7">
\t\t\t<img src="(img/.+?)"}s
PATTERN;
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Ошибка при выделении элементов.");
        }
        foreach ($matches as $m) {
            $url = getRealUrl(basePath($this->url), $m[1]);
            $item = $this->getItemInfo($url);
            $item["image_small"] = getRealUrl(basePath($this->url), $m[2]);
            $items[] = $item;
        }
        return $items;
    }
 function parseItems()
 {
     $items = array();
     $pattern = "{<a href='javascript:launchImg\\(\"(.+?)\",(\\d+)\\).+?\n\t\t\tsrc='(catalog/.+?)'.+?<b>(.+?)</b>.+?\n\t\t\t<b>јртикул:</b>(.+?)</td>.+?\n\t\t\t<b>Ѕренд:</b>(.+?)</td>.+?\n\t\t\t<b>÷ена:</b>(.+?)</td>}s";
     $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
     if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
         return new PEAR_Error("Items not found.");
     }
     foreach ($matches as $m) {
         $art = trim($m[5]);
         $imgSmall = getRealUrl(basePath($this->url), $m[3]);
         $img = "catalog/" . $m[2] . "/big/" . $m[1] . ".jpg";
         $img = getRealUrl(basePath($this->url), $img);
         $name = trim($m[4]);
         $brandname = trim($m[6]);
         $price = trim($m[7]);
         $items[] = array("art" => $art, "image_large" => $img, "image_small" => $imgSmall, "url" => $this->url, "name" => $name, "brandname" => $brandname, "price" => $price);
     }
     return $items;
 }
    function parseItems()
    {
        $items = array();
        $pattern = <<<PATTERN
{<td width="22%"><img src="([^"]+?)"
\twidth=".+?" height=".+?" alt="(.+?)"></td>}s
PATTERN;
        $pattern = preg_replace("{\\s+}", "\\s*", $pattern);
        if (!preg_match_all($pattern, $this->pageContent, $matches, PREG_SET_ORDER)) {
            return new PEAR_Error("Items not found.");
        }
        foreach ($matches as $m) {
            $item = array();
            $item["image_large"] = getRealUrl(basePath($this->url), $m[1]);
            $item["name"] = $m[2];
            $item["url"] = $this->url;
            $items[] = $item;
        }
        return $items;
    }