public function __construct() { gateKeeper(); $user = getLoggedInUser(); $user->createAvatar(); if (isEnabledPlugin("photos")) { $album = getEntity(array("type" => "Photoalbum", "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid()), array("name" => "title", "value" => "Profile Avatars")))); $photo = new Photo(); $photo->owner_guid = getLoggedInUserGuid(); $photo_guid = $photo->save(); Image::copyAvatar($user, $photo); $photo = getEntity($photo_guid); if (!$album) { $album = new Photoalbum(); $album->owner_guid = getLoggedInUserGuid(); $album->title = "Profile Avatars"; $album_guid = $album->save(); $album = getEntity($album_guid); Image::copyAvatar($photo, $album); } $photo->container_guid = $album->guid; $photo->save(); } runHook("action:edit_avatar:after", array("user" => $user)); new Activity(getLoggedInUserGuid(), "activity:avatar:updated", array($user->getURL(), $user->full_name)); new SystemMessage("Your avatar has been uploaded."); forward("profile/" . $user->guid); }
public function __construct() { $title = getInput("title"); $description = getInput("description"); $access_id = getInput("access_id"); Security::checkForEmptyFields(array("title")); $logged_in_user = getLoggedInUser(); $logged_in_user_guid = $logged_in_user->guid; $album = new Photoalbum(); $album->title = $title; $album->description = $description; $album->owner_guid = $logged_in_user_guid; $album->access_id = $access_id; $album->save(); $album->createAvatar(); new Activity(getLoggedInUserGuid(), "activity:add:photo:album", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $album->getURL(), $album->title, "<a href='" . $album->getURL() . "'>" . $album->icon(EXTRALARGE, "img-responsive") . "</a>")); new SystemMessage("Your album has been created."); forward("photos"); }
$smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $smarty->assign("mode", "archive"); $news_list = $db->get_all("SELECT * FROM fw_news WHERE {$where} ORDER BY publish_date DESC " . $limit_all); $page_title = $node_content['name'] . ' - ' . 'јрхив'; $smarty->assign("news_list", $news_list); $template = 'news_list.html'; break; case preg_match("/^([0-9]+)\$/", $url[$n]) && $url[$n - 1] == 'archive' && count($url) == 3: $navigation[] = array("url" => "archive", "title" => "јрхив"); $id = $url[$n]; $result = $db->get_single("SELECT * FROM fw_news WHERE id='{$id}' AND status='1'"); if ($result['id'] > 0) { // ----парсинг контекта дл¤ вставки фотоальбома, таблицы и формы -- // $photo = new Photoalbum(); $result['text'] = $photo->pregReplace($result['text'], BASE_PATH, PHOTOS_FOLDER, PHOTOS_PER_PAGE_SUP); $table = new Table(); $result['text'] = $table->pregReplace($result['text'], BASE_PATH); $form = new Form(); $result['text'] = $form->pregReplace($result['text'], BASE_PATH); // ---- конец парсинга контекта дл¤ вставки фотоальбома, таблицы и формы -- // $page_found = true; $navigation[] = array("url" => $result['title'], "title" => $result['title']); $page_title = $node_content['name'] . ' - ' . $result['title']; $smarty->assign("single_news", $result); $template = 'show_single_news.html'; } break; } }
$url_to_check = implode("/", $url) . '/'; if ($cat_list[$f]['full_url'] == '/') { $cat_list[$f]['full_url'] = ''; } if ($cat_list[$f]['full_url'] . $product_content['id'] . '/' == $url_to_check && $product_content['parent'] == $cat_list[$f]['id']) { $page_found = true; if ($product_content['title'] != '') { $page_title = $product_content['title']; } else { $page_title = $product_content['name']; } $price = $product_content['price']; $product_content['price'] = number_format($product_content['price'] * $cur_admin['kurs'] / $cur_site['kurs'], 2); $product_content['price2'] = number_format($price * $cur_admin['kurs'] / $cur_site2['kurs'], 2); // ----парсинг контекта для вставки фотоальбома, таблицы и формы -- // $photo = new Photoalbum(); $product_content['description'] = $photo->pregReplace($product_content['description'], BASE_PATH, PHOTOS_FOLDER, PHOTOS_PER_PAGE_SUP); $table = new Table(); $product_content['description'] = $table->pregReplace($product_content['description'], BASE_PATH); $form = new Form(); $product_content['description'] = $form->pregReplace($product_content['description'], BASE_PATH); // ---- конец парсинга контекта для вставки фотоальбома, таблицы и формы -- // $smarty->assign("product", $product_content); if ($product_content['additional_products'] != '') { $additional_products = $db->get_all("SELECT * FROM fw_products WHERE id IN (" . $product_content['additional_products'] . ")"); for ($a = 0; $a < count($additional_products); $a++) { for ($a1 = 0; $a1 < count($cat_list); $a1++) { if ($additional_products[$a]['parent'] == $cat_list[$a1]['id']) { $additional_products[$a]['full_url'] = $cat_list[$a1]['full_url']; } }
function createPhotoAlbum($params) { $description = ""; $title = $params['title']; if (isset($params['description'])) { $description = $params['description']; } if (isset($params['access_id'])) { $access_id = $params['access_id']; } else { $access_id = "public"; } $owner_guid = $params['owner_guid']; $album = new Photoalbum(); $album->title = $title; $album->description = $description; $album->owner_guid = $owner_guid; $album->access_id = $access_id; if (isset($params['image'])) { $album->icon = uploadBase64Image($params['image']); } $album->save(); $user = getEntity($owner_guid); new Activity($owner_guid, "activity:add:photo:album", array($user->getURL(), $user->full_name, $album->getURL(), $album->title, "<a href='" . $album->getURL() . "'>" . $album->icon(EXTRALARGE, "img-responsive") . "</a>")); return $album->guid; }
$document = $db->get_single("SELECT * FROM fw_documents WHERE id='" . $select_item . "' AND status='1'"); if ($document['parent'] == $page_content['id']) { $page_found = true; if ($document['title'] != '') { $page_title = $document['title']; } else { $page_title = $document['name']; } if ($document['meta_keywords'] != '') { $meta_keywords = $document['meta_keywords']; } if ($document['meta_description'] != '') { $meta_description = $document['meta_description']; } $navigation[] = array("url" => "item_" . $document['id'], "title" => trim($document['name'])); $photo = new Photoalbum(); $document['description'] = $photo->pregReplace($document['description'], BASE_PATH, PHOTOS_FOLDER, PHOTOS_PER_PAGE_SUP); $document['small_description'] = $photo->pregReplace($document['small_description'], BASE_PATH, PHOTOS_FOLDER, PHOTOS_PER_PAGE_SUP); $table = new Table(); $document['description'] = $table->pregReplace($document['description'], BASE_PATH); $document['small_description'] = $table->pregReplace($document['small_description'], BASE_PATH); $form = new Form(); $document['description'] = $form->pregReplace($document['description'], BASE_PATH); $document['small_description'] = $form->pregReplace($document['small_description'], BASE_PATH); $smarty->assign("document", $document); $smarty->assign("content", $smarty->fetch($templates_path . "/document_elements.html")); } } break; } else { $page_found = true;