Пример #1
0
 /**
  * Checks if the product is new, and sets the created and modified times appropriately,
  * prior to saving.
  * @see testProjectModel::beforeSave()
  */
 public function beforeSave()
 {
     if ($this->isNew) {
         $this->created = date("Y-m-d H:i:s");
         $this->modified = $this->created;
         $this->user = Auth::User()->id;
     } else {
         $this->modified = date("Y-m-d H:i:s");
     }
     $tags = isset($this->attributes['tags']) ? $this->attributes['tags'] : array();
     foreach ($tags as $i => $tag) {
         if (!is_numeric($tag)) {
             $tagModel = new tags(array('name' => $tag));
             $tagModel->save();
             $tags[$i] = $tagModel->id;
         } else {
             $tags[$i] = intval($tag);
         }
     }
     $this->tagIds = $tags;
     unset($this->attributes['tags']);
     if (!is_numeric($this->vendor)) {
         $vendor = new vendors(array('name' => $this->vendor));
         $vendor->save();
         $this->vendor = $vendor->id;
     }
     $this->cleanDates(array('purchaseDate', 'saleDate', 'soldDate'));
     return true;
 }
Пример #2
0
function translation_statistics_category_lang($lang) {
  $list=array();

  $sql_str="select category.* from category_current left join category on category_current.version=category.version";
  $res=sql_query($sql_str);
  while($elem=pg_fetch_assoc($res)) {
    $tags=new tags(parse_hstore($elem['tags']));
    $cat_lang=coalesce($tags->get("lang"), "en");

    if(($s=$tags->get("name:$lang"))||(($s=$tags->get("name"))&&$lang==$cat_lang))
      $list["category:{$elem['category_id']}:name"]=$s;
    if(($s=$tags->get("description:$lang"))||(($s=$tags->get("description"))&&$lang==$cat_lang))
    $list["category:{$elem['category_id']}:description"]=$s;

    $sql_str="select * from category_rule where version='{$elem['version']}'";
    $res_r=sql_query($sql_str);
    while($elem_r=pg_fetch_assoc($res_r)) {
      $tags_r=new tags(parse_hstore($elem_r['tags']));

      if(($s=$tags_r->get("name:$lang"))||(($s=$tags_r->get("name"))&&$lang==$cat_lang))
	$list["category:{$elem['category_id']}:{$elem_r['rule_id']}:name"]=$s;
    }
  }

  return $list;
}
Пример #3
0
function tags_show()
{
    global $tag;
    global $objects;
    $tag = new tags();
    $objects = $tag->find($_GET['id']);
    render();
}
Пример #4
0
function category_history_recent_changes($list) {
  $res=sql_query("select * from category where version_tags ? 'date' order by version_tags->'date' desc limit 50");
  while($elem=pg_fetch_assoc($res)) {
    $elem['version_tags']=parse_hstore($elem['version_tags']);
    $t=new tags(parse_hstore($elem['tags']));

    $entry=$elem['version_tags'];
    $entry['name']=sprintf("%s \"%s\"", lang("category", 1), $t->get_lang("name"));
    $entry['msg']=coalesce($elem['version_tags']['msg'], "no message");
    $entry['plugin']="category";
    $entry['href']="javascript:category_show(\"osm:{$elem['category_id']}\", { version: \"{$elem['version']}\"})";

    $list[]=$entry;
  }
}
Пример #5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = tags::find()->where('status=0');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy, 'createdOn' => $this->createdOn, 'updatedOn' => $this->updatedOn, 'status' => $this->status, 'issystem' => $this->issystem]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'ip', $this->ip]);
     return $dataProvider;
 }
Пример #6
0
 /**
  * @return HTML
  * @param int $obj_id - ID раздела, для которого необходимо вывести теги.
  * @param string $templ_name - Шаблон оформления.
  * @desc МАКРОС: Выводит список тегов для указанной страницы.
  */
 public function tags($obj_id, $templ_name = 'tags')
 {
     $templ_file = '/search/' . $templ_name . '.tpl';
     $TEMPLATE = page::getTemplate($templ_file);
     if (!is_array($TEMPLATE)) {
         return page::errorNotFound('search.tags', $templ_file);
     }
     $tags = tags::getTagsForObject($obj_id);
     $list = '';
     while (list($num, $tag) = each($tags)) {
         page::assign('obj.id', $tag['id']);
         page::assign('obj.name', $tag['name']);
         page::assign('obj.count', $tag['count']);
         page::assign('obj.url', '/search/tag/' . $tag['id']);
         $list .= !empty($num) ? page::parse($TEMPLATE['separator']) : '';
         $list .= page::parse($TEMPLATE['list']);
     }
     if (!empty($list)) {
         page::assign('list', $list);
         return page::parse($TEMPLATE['frame']);
     } else {
         return page::parse($TEMPLATE['empty']);
     }
 }
Пример #7
0
 /**
  * Return a file
  *
  * @param string $id File ID
  * @return array $file File details
  */
 function getFile($id)
 {
     $id = (int) $id;
     // get the file from MySQL
     $sel = mysql_query("SELECT * FROM files WHERE ID={$id}");
     $file = mysql_fetch_array($sel);
     if (!empty($file)) {
         // determine if there is an mimetype icon corresponding to the files mimetype. If not set 'none'
         $file['type'] = str_replace("/", "-", $file["type"]);
         $set = new settings();
         $settings = $set->getSettings();
         $myfile = "./templates/" . $settings["template"] . "/images/files/" . $file['type'] . ".png";
         if (!file_exists($myfile)) {
             $file['type'] = "none";
         }
         // determine if its an image or textfile or some other file. this is needed for lightboxes
         if (stristr($file['type'], "image")) {
             $file['imgfile'] = 1;
         } elseif (stristr($file['type'], "text")) {
             $file['imgfile'] = 2;
         } else {
             $file['imgfile'] = 0;
         }
         // split the tags string into an array, and also count how many tags the file has
         $tagobj = new tags();
         $thetags = $tagobj->splitTagStr($file["tags"]);
         $file["tagsarr"] = $thetags;
         $file["tagnum"] = count($file["tagsarr"]);
         // strip slashes from titles , desc and tags
         $file["title"] = stripslashes($file["title"]);
         $file["desc"] = stripslashes($file["desc"]);
         $file["tags"] = stripslashes($file["tags"]);
         $file["size"] = filesize(realpath($file["datei"])) / 1024;
         $file["size"] = round($file["size"]);
         $file["addedstr"] = date("d.m.y", $file["added"]);
         $userobj = new user();
         $file["userdata"] = $userobj->getProfile($file["user"]);
         return $file;
     } else {
         return false;
     }
 }
Пример #8
0
        $itemsClass = new items();
        $s = $itemsClass->add();
        if ($s === true) {
            refresh('/' . $languageURL . 'author_dashboard/', $langArray['complete_upload_item'], 'complete');
        } else {
            $message = '<ul>';
            foreach ($s as $e) {
                $message .= '<li>' . $e . '</li>';
            }
            $message .= '</ul>';
            addErrorMessage($message, '', 'error');
        }
    }
    $fileTypes = '';
    foreach ($config['upload_ext'] as $ext) {
        if ($fileTypes != '') {
            $fileTypes .= ';';
        }
        $fileTypes .= '*.' . $ext;
    }
    abr('fileTypes', $fileTypes);
    abr('sessID', session_id());
}
//获取所有推荐标签
require_once ROOT_PATH . '/apps/tags/models/tags.class.php';
$tagsClass = new tags();
$tags_all = $tagsClass->getAll();
$all_tags = json_encode($tags_all);
abr('all_tags', $all_tags);
#面包屑
abr('breadcrumb', '<a href="/' . $languageURL . '" title="">' . $langArray['home'] . '</a> \\ <a href="/' . $languageURL . 'upload/form/?category=' . $_GET['category'] . '" title="">' . $langArray['upload_theme'] . '</a>');
Пример #9
0
 public static function get($string)
 {
     //current year
     $string = str_replace('[year]', date('Y'), $string);
     //name of website
     $string = str_replace('[sitetitle]', SITETITLE, $string);
     //site email address
     $string = str_replace('[siteemail]', SITEEMAIL, $string);
     //facebook like box
     $string = preg_replace_callback("(\\[facebooklikebox(.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         //if key exits use it
         $username = isset($params['username']) ? $params['username'] : '';
         $width = isset($params['width']) ? $params['width'] : '300px';
         $height = isset($params['height']) ? $params['height'] : '258px';
         $colorscheme = isset($params['colorscheme']) ? $params['colorscheme'] : 'light';
         $showfaces = isset($params['showfaces']) ? $params['showfaces'] : 'true';
         $header = isset($params['header']) ? $params['header'] : 'true';
         $stream = isset($params['stream']) ? $params['stream'] : 'false';
         $showborder = isset($params['showborder']) ? $params['showborder'] : 'false';
         $scrolling = isset($params['scrolling']) ? $params['scrolling'] : 'no';
         $likebox = "<iframe src='//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2F{$username}&amp;\n            width={$width}&amp;\n            height={$height}&amp;\n            colorscheme={$colorscheme}&amp;\n            show_faces={$showfaces}&amp;\n            header={$header}&amp;\n            stream={$stream}&amp;\n            show_border={$showborder}&amp;\n            appId=262411407271009'\n            scrolling='{$scrolling}'\n            frameborder='0'\n            style='border:none; overflow:hidden; width:{$width}; height:{$height};'\n            allowTransparency='true'></iframe>";
         return $likebox;
     }, $string);
     //feedburner subscribe form
     $string = preg_replace_callback("(\\[feedburner(.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         $username = isset($params['username']) ? $params['username'] : '';
         $form = "<form action='https://feedburner.google.com/fb/a/mailverify' method='post' target='popupwindow' onsubmit='window.open('http://feedburner.google.com/fb/a/mailverify?uri={$username}', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true' class='navbar-form'>\n            <input type='hidden' value='{$username}' name='uri'>\n            <input type='hidden' name='loc' value='en_US'>\n              <p><input type='text' class='form-control' placeholder='Enter Email Address' name='email' id='srch-term'></p>\n              <p><input class='btn btn-success' type='submit' value='Subscribe by Email'></p>\n            </form>";
         return $form;
     }, $string);
     //google plus box
     $string = preg_replace_callback("(\\[googleplusbox(.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         $username = isset($params['username']) ? $params['username'] : '';
         return "<script src='https://apis.google.com/js/platform.js' async defer></script>\n                    <g:page href='https://plus.google.com/+{$username}'></g:page>";
     }, $string);
     //google adbox
     $string = preg_replace_callback("(\\[googleadbox])is", function ($matches) {
         ob_start();
         ?>
         <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
         <!-- dcsidebar -->
         <ins class="adsbygoogle"
              style="display:block"
              data-ad-client="ca-pub-0401085377924210"
              data-ad-slot="3065264368"
              data-ad-format="auto"></ins>
         <script>
         (adsbygoogle = window.adsbygoogle || []).push({});
         </script>
         <?php 
         $ad = ob_get_clean();
         return $ad;
     }, $string);
     //twitter follow button
     $string = preg_replace_callback("(\\[twitterfollowbutton(.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         if (!isset($params['count'])) {
             $params['count'] = null;
         }
         if (!isset($params['size'])) {
             $params['size'] = null;
         }
         //if key exits use it
         $username = isset($params['username']) ? $params['username'] : '';
         $count = $params['count'] == 'no' ? "data-show-count='false'" : '';
         $size = $params['size'] == 'large' ? "data-size='large'" : '';
         return "<a href='https://twitter.com/{$username}' class='twitter-follow-button' {$count} {$size}>Follow @{$username}</a>\n        <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>";
     }, $string);
     //twitter share button
     $string = preg_replace_callback("(\\[twittersharebutton(.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         if (!isset($params['count'])) {
             $params['count'] = null;
         }
         if (!isset($params['size'])) {
             $params['size'] = null;
         }
         //if key exits use it
         $count = $params['count'] == 'no' ? "data-count='none'" : '';
         $size = $params['size'] == 'large' ? "data-size='large'" : '';
         $via = isset($params['via']) ? "data-via='{$params['via']}'" : '';
         $hash = isset($params['hash']) ? "data-hashtags='{$params['hash']}'" : '';
         return "<a href='https://twitter.com/share' class='twitter-share-button' {$count} {$size} {$via} {$hash}>Tweet</a>\n        <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>";
     }, $string);
     //youtube embeds
     $string = preg_replace_callback("(\\[youtube (.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         //if key exits use it
         $video = isset($params['video']) ? $params['video'] : '';
         $video = str_replace("https://www.youtube.com/watch?v=", "", $video);
         $width = isset($params['width']) ? $params['width'] : '640';
         $height = isset($params['height']) ? $params['height'] : '360';
         return "<iframe width='{$width}' height='{$height}' src='//www.youtube.com/embed/{$video}' frameborder='0' allowfullscreen></iframe>";
     }, $string);
     //youtube subscribe
     $string = preg_replace_callback("(\\[youtubesub(.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         if (!isset($params['count'])) {
             $params['count'] = null;
         }
         if (!isset($params['size'])) {
             $params['size'] = null;
         }
         $username = isset($params['username']) ? $params['username'] : '';
         $layout = $params['layout'] == 'full' ? 'full' : 'default';
         $count = $params['count'] == 'no' ? 'hidden' : 'default';
         return "<script src='https://apis.google.com/js/platform.js'></script>\n                <div class='g-ytsubscribe' data-channel='{$username}' data-layout='{$layout}' data-count='{$count}'></div>";
     }, $string);
     //vimeo embeds
     $string = preg_replace_callback("(\\[vimeo (.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         //if key exits use it
         $video = isset($params['video']) ? $params['video'] : '';
         $video = str_replace("https://vimeo.com/", "", $video);
         $width = isset($params['width']) ? $params['width'] : '640';
         $height = isset($params['height']) ? $params['height'] : '360';
         return "<iframe width='{$width}' height='{$height}' src='https://player.vimeo.com/video/{$video}' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
     }, $string);
     //pages get children
     $string = preg_replace_callback("(\\[pages (.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         $items = null;
         //if key exits use it
         $parent = isset($params['parent']) ? $params['parent'] : '';
         $class = isset($params['class']) ? $params['class'] : '';
         $id = isset($params['id']) ? $params['id'] : '';
         $subclass = isset($params['subclass']) ? $params['subclass'] : '';
         $subid = isset($params['subid']) ? $params['subid'] : '';
         $db = Connection::get();
         $q = $db->select("SELECT pageID,pageParent,pageMenuTitle,pageSlug FROM " . PREFIX . "pages WHERE pageParent=:parent AND pageStandAlone='0' ORDER BY pageOrder", array(':parent' => $parent));
         //if page is more then 0 then show drop down menu
         if (count($q) > 0) {
             $items = "<ul class='{$class}' id='{$id}'>\n";
             foreach ($q as $row) {
                 //if slug is external use it
                 if (preg_match("/http/i", $row->pageSlug)) {
                     $rowSlug = $row->pageSlug;
                 } else {
                     //otherwise add in the DIR
                     $rowSlug = DIR . $row->pageSlug;
                 }
                 $items .= "<li><a href='{$rowSlug}'>{$row->pageMenuTitle}</a>";
                 $q2 = $db->select("SELECT pageMenuTitle,pageSlug FROM " . PREFIX . "pages WHERE pageParent=:parent AND pageStandAlone='0' ORDER BY pageOrder", array(':parent' => $row->pageID));
                 if (count($q2) > 0) {
                     $items .= "<ul class='{$subclass}' id='{$subid}'>\n";
                     foreach ($q2 as $row2) {
                         //if slug is external use it
                         if (preg_match("/http/i", $row2->pageSlug)) {
                             $row2Slug = $row2->pageSlug;
                         } else {
                             //otherwise add in the DIR
                             $row2Slug = DIR . $row2->pageSlug;
                         }
                         $items .= "<li><a href='{$row2Slug}'>{$row2->pageMenuTitle}</a></li>";
                     }
                     $items .= "</ul>";
                 }
                 $items .= "</li>";
             }
             $items .= "</ul>";
         }
         return $items;
     }, $string);
     return $string;
 }
Пример #10
0
 public function tagAction()
 {
     $templ_file = '/search/gettag.tpl';
     $TEMPLATE = page::getTemplate($templ_file);
     if (!is_array($TEMPLATE)) {
         return page::errorNotFound('search.getTag', $templ_file);
     }
     if (system::issetUrl(2) && ($tag = tags::infoTag(system::url(2)))) {
         $msg = lang::get('SEARCH_H1_TAGS') . ' "' . $tag['name'] . '"';
         page::globalVar('h1', $msg);
         page::globalVar('title', $msg);
         // Получаем список классов
         $classes_filter = array();
         if (!empty($_POST['classes'])) {
             $tmp = explode(",", $_POST['classes']);
             $classes_filter = array();
             foreach ($tmp as $v) {
                 $v = trim($v);
                 if (!empty($v)) {
                     $classes_filter[] = $v;
                 }
             }
         }
         $max_count = reg::getKey(ormPages::getPrefix('search') . '/max_count');
         $start = (system::getCurrentNavNum() - 1) * $max_count;
         $result = tags::find(array($tag['id']), $max_count, $start, $classes_filter);
         $list = '';
         while (list($num, $val) = each($result['pages'])) {
             if ($page = ormPages::get($val['page_id'])) {
                 page::assign('obj.id', $page->id);
                 page::assign('obj.num', $num + $start + 1);
                 page::assign('obj.name', $page->name);
                 page::assign('obj.url', $page->_url);
                 //page::assign('obj.content', $page->content);
                 $cn = $page->getClass()->getSName();
                 $block_name = isset($TEMPLATE['list_' . $cn]) ? 'list_' . $cn : 'list';
                 $list .= page::parse($TEMPLATE[$block_name]);
             }
         }
         page::assign('count_page', ceil($result['count'] / $max_count));
     } else {
         $list = '';
         $msg = lang::get('SEARCH_H1_TAGS2');
         page::globalVar('h1', $msg);
         page::globalVar('title', $msg);
     }
     if (!empty($list)) {
         page::assign('list', $list);
         page::fParse('list', $TEMPLATE['frame_list']);
     } else {
         page::fParse('list', $TEMPLATE['not_found']);
     }
     return page::parse($TEMPLATE['frame']);
 }
Пример #11
0
    }
    if (array_key_exists("calories", $_POST)) {
        $recipe->setcalories($_POST['calories']);
    }
    if (array_key_exists("countryId", $_POST)) {
        $origin = $_POST["countryId"];
        if ($origin != "-1") {
            $recipe->setorigin($origin);
        }
    }
    if (array_key_exists("categoryId", $_POST)) {
        $category = $_POST["categoryId"];
        if ($category != "-1") {
            $recipe->setcategory($category);
        }
    }
    if (array_key_exists("tags", $_POST)) {
        $tags = TagService::processTags($_POST["tags"]);
        foreach ($tags as $current) {
            $newTag = new tags();
            $newTag->settagNames($current);
            $recipe->addtags($newTag);
        }
    }
    $saved = ItemService::saveWithValidation($recipe, 200);
    if ($saved == true) {
        $id = $recipe->getId();
        $result = array("id" => $id);
        echo json_encode($result);
    }
});
     $result = array();
     for ($i = 0; $i < count($tags->result); $i++) {
         $item['tag'] = $tags->result[$i]->tag;
         $result[] = $item;
         //				echo html_entity_decode($tags->result[$i]->tag)."\n";
     }
     echo json_encode($result);
     break;
     // Bestelldetail Tags
 // Bestelldetail Tags
 case 'detail_tags':
     //	$detail = $_REQUEST['detail_id'];
     $tag_search = trim(isset($_REQUEST['term']) ? $_REQUEST['term'] : '');
     //if (is_null($detail) || $tag_search=='')
     //	exit();
     $tags = new tags();
     if (!$tags->getAll()) {
         exit($tags->errormsg . "\n");
     }
     $result = array();
     for ($i = 0; $i < count($tags->result); $i++) {
         $item['tag'] = $tags->result[$i]->tag;
         $result[] = $item;
         //				echo html_entity_decode($tags->result[$i]->tag)."\n";
     }
     echo json_encode($result);
     break;
 case 'wawi_mitarbeiter_search':
     $search = trim(isset($_REQUEST['term']) ? $_REQUEST['term'] : '');
     if (is_null($search) || $search == '') {
         exit;
Пример #13
0
 /**
  * Редактировать комментарий
  *
  * @param integer $id ИД редактируемого комментария
  * @return array  [коды ошибок, описание ошибок] (по умолчанию оба занчения null)
  */
 function editComment($id)
 {
     $DB = new DB('master');
     $blog = $_POST['blogID'];
     $user = get_uid();
     $IDEdit = $id;
     //intval($this->uri[3]);
     $alert = array();
     $deleted_attach = $_POST['editattach'];
     if ($deleted_attach) {
         foreach ($deleted_attach as $key => $val) {
             if ($val == 1) {
                 front::og("db")->delete("DELETE FROM corporative_blog_attach WHERE id = ?n", $key);
             }
         }
     }
     if (strlen($_POST['msg']) > blogs::MAX_DESC_CHARS) {
         $error_flag = 1;
         $alert[2] = "Максимальный размер сообщения " . blogs::MAX_DESC_CHARS . " символов!";
         $msg =& $_POST['msg'];
     } else {
         $msg = $_POST['msg'];
         $msg = preg_replace("/<ul.*>/Ui", "<ul>", $msg);
         $msg = preg_replace("/<li.*>/Ui", "<li>", $msg);
         $msg = change_q_x_a(antispam($msg), false, false);
     }
     $msg_name = substr(change_q_x(antispam($_POST['title']), true), 0, 96);
     $yt_link = substr(change_q_x(antispam(str_replace('watch?v=', 'v/', $_POST['yt_link'])), true), 0, 128);
     if ($yt_link != '') {
         if (strpos($yt_link, 'http://ru.youtube.com/v/') !== 0 && strpos($yt_link, 'http://youtube.com/v/') !== 0 && strpos($yt_link, 'http://www.youtube.com/v/') !== 0) {
             $error_flag = 1;
             $alert[4] = "Неверная ссылка.";
         }
     }
     if (is_empty_html($msg)) {
         $msg = '';
     }
     // загрузка файлов
     $attach = $_FILES['attach'];
     if (is_array($attach) && sizeof($attach) <= 10) {
         if (is_array($attach) && !empty($attach['name'])) {
             foreach ($attach['name'] as $key => $v) {
                 if (!$attach['name'][$key]) {
                     continue;
                 }
                 $files[] = new CFile(array('name' => $attach['name'][$key], 'type' => $attach['type'][$key], 'tmp_name' => $attach['tmp_name'][$key], 'error' => $attach['error'][$key], 'size' => $attach['size'][$key]));
             }
         }
         if ($group == 7) {
             $max_image_size = array('width' => 400, 'height' => 600, 'less' => 0);
         } else {
             $max_image_size = array('width' => 470, 'height' => 1000, 'less' => 0);
         }
         list($files, $alert_, $error_flag___) = self::uploadFile($files, $max_image_size);
         $error_flag = max($error_flag___, $error_flag);
         if (is_array($alert_)) {
             $alert = array_merge($alert, $alert_);
         }
     } else {
         if (is_array($attach) && !empty($attach['name'])) {
             $error_flag = 1;
             $alert[2] = "Файлов не должно быть больше 10";
         }
     }
     if (!$msg && !count($files)) {
         $error_flag = 1;
         $alert[2] = "Поле заполнено некорректно";
     }
     if (($msg || $files['f_name'][0]) && get_uid() && !$error_flag) {
         $upd = array("title" => $msg_name, "yt_link" => $yt_link, "msg" => $msg, "id_modified" => get_uid(), "id_deleted" => 0, "date_change" => date("Y-m-d H:i:s"));
         front::og("db")->update("UPDATE corporative_blog SET ?s WHERE (id = ?n)", $upd, $IDEdit);
         if (is_array($files)) {
             $asql = '';
             for ($i = 0; $i < count($files['f_name']); $i++) {
                 if ($files['f_name'][$i]) {
                     $asql .= ", ({$IDEdit}, '{$files['f_name'][$i]}', '{$files['tn'][$i]}')";
                 }
             }
             if ($asql) {
                 $asql = substr($asql, 2);
             }
         }
         if ($asql) {
             $DB->query("INSERT INTO corporative_blog_attach(msg_id, \"name\", small) VALUES {$asql}");
         }
         $tags = $_POST['tags'];
         if ($tags) {
             $tags_arr = $tags;
             //explode(",", $tags);
             array_unique($tags_arr);
             $this->tagsDelete($IDEdit);
             $tg = tags::Add($tags_arr);
             $this->tagsAdd($IDEdit, $tg);
         }
     }
     front::og("tpl")->ederror_flag = $error_flag;
     front::og("tpl")->edalert = $alert;
     front::og("tpl")->edpost = array("blog" => $blog, "user" => $user, "parent" => $parent, "msg" => $msg, "title" => $msg_name, "yt_link" => $yt_link);
     return array($error_flag, $error);
 }
Пример #14
0
 /**
  * Get a user profile
  *
  * @param int $id User ID
  * @return array $profile Profile
  */
 function getProfile($id)
 {
     global $conn;
     $id = (int) $id;
     $sel = $conn->query("SELECT * FROM user WHERE ID = {$id}");
     $profile = $sel->fetch();
     if (!empty($profile)) {
         $profile["name"] = stripslashes($profile["name"]);
         if (isset($profile["company"])) {
             $profile["company"] = stripslashes($profile["company"]);
         }
         if (isset($profile["adress"])) {
             $profile["adress"] = stripslashes($profile["adress"]);
         }
         if (isset($profile["adress2"])) {
             $profile["adress2"] = stripslashes($profile["adress2"]);
         }
         if (isset($profile["state"])) {
             $profile["state"] = stripslashes($profile["state"]);
         }
         if (isset($profile["country"])) {
             $profile["country"] = stripslashes($profile["country"]);
         }
         $tagsobj = new tags();
         $profile["tagsarr"] = $tagsobj->splitTagStr($profile["tags"]);
         $rolesobj = (object) new roles();
         $profile["role"] = $rolesobj->getUserRole($profile["ID"]);
         return $profile;
     } else {
         return false;
     }
 }
Пример #15
0
    protected function createObject()
    {
        // Проверяем обязательность полей
        reset($this->fields);
        while (list($fname, $field) = each($this->fields)) {
            if ($field['f_required'] && $field['f_relation'] == 2) {
                if (empty($this->new_parents) && !$this->issetParents()) {
                    $this->newError(40, 'Поле "' . $field['f_name'] . '" обязательно для заполнения!', $fname);
                }
            } else {
                if (($field['f_type'] == 40 || $field['f_type'] == 45) && isset($this->new_prop[$fname]) && empty($this->new_prop[$fname])) {
                    $this->new_prop[$fname] = 0;
                } else {
                    if ($field['f_required'] && empty($this->new_prop[$fname]) && (empty($this->cur_prop[$fname]) || isset($this->new_prop[$fname]))) {
                        $this->newError(40, 'Поле "' . $field['f_name'] . '" обязательно для заполнения!', $fname);
                    }
                }
            }
        }
        if ($this->issetErrors() > 0) {
            return false;
        }
        // Основные характеристики объекта
        $sql = 'INSERT INTO <<objects>>
					SET o_class_id = "' . $this->class->id() . '",
						o_name = "' . $this->name . '",
						o_change_date = "' . date('Y-m-d H:i:s') . '",
						o_create_date = "' . date('Y-m-d H:i:s') . '";';
        $this->id = db::q($sql);
        if ($this->id === false) {
            $this->newError(42, 'Ошибка в SQL запросе, при добавлении объекта!');
            return false;
        }
        // Изменяем данные объекта
        $fields = '';
        if (!empty($this->new_prop)) {
            while (list($key, $value) = each($this->new_prop)) {
                if (!$this->isPageField($key) && $key != 'name') {
                    if ($this->fields[$key]['f_type'] != 105) {
                        $fields .= $this->procValue($key, $value);
                    } else {
                        tags::changeTags($value, $this->id);
                    }
                }
            }
        }
        $fields = substr($fields, 0, strlen($fields) - 2);
        if (!empty($fields)) {
            $fields = ', ' . $fields;
        }
        $sql = 'INSERT INTO  <<__' . $this->class->getSName() . '>>
					SET obj_id = "' . $this->id . '"' . $fields . ';';
        if (db::q($sql) !== false) {
            /*
                    if (!empty($this->new_prop))
            while (list($key, $value) = each ($this->new_prop))
                $this->procValue($key, $value);
            */
            while (list($key, $field_id) = each($this->subject)) {
                $form = new ormMultiForm('subject_list_' . $field_id);
                $form->process('save_subject', $this->id);
            }
            $this->next_prinud = true;
            $this->changeParents(false);
            return $this->id;
        } else {
            $this->newError(42, 'Ошибка в SQL запросе, при добавлении данных объекта!');
            return false;
        }
    }
Пример #16
0
    $projectname = $pro["name"];

    $template->assign("title", $title);
    $template->assign("file", $file);
    $template->assign("projectname", $projectname);

    $template->display("editfileform.tpl");
} elseif ($action == "edit") {
    if (!$userpermissions["files"]["edit"]) {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "<h2>$errtxt</h2><br>$noperm");
        $template->display("error.tpl");
        die();
    }
    $tagobj = new tags();
    $tags = $tagobj->formatInputTags($tags);
    if ($myfile->edit($thisfile, $title, $desc, $tags)) {
        $loc = $url .= "managefile.php?action=showproject&id=$id&mode=edited";
        header("Location: $loc");
    }
} elseif ($action == "delete") {
    if (!$userpermissions["files"]["del"]) {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "<h2>$errtxt</h2><br>$noperm");
        $template->display("error.tpl");
        die();
    }
    if ($myfile->loeschen($thisfile)) {
        echo "ok";
Пример #17
0
    $template->assign("trackbar", $trackbar);
    $template->assign("logbar", $logbar);
    $template->assign("statbar", $statbar);
    $milestone = (object) new milestone();
    $mylog = (object) new mylog();
    $task = new task();
    $ptasks = $task->getProjectTasks($id, 1);
    $today = date("d");

    $log = $mylog->getProjectLog($id);
    $log = $mylog->formatdate($log);

    $tproject = $project->getProject($id);
    $done = $project->getProgress($id);

    $cloud = new tags();
    $cloud->cloudlimit = 1;
    $thecloud = $cloud->getTagcloud($id);
    if (strlen($thecloud) > 0) {
        $template->assign("cloud", $thecloud);
    }

    $title = $langfile['project'];
    $title = $title . " " . $tproject["name"];
    $template->assign("title", $title);

    $template->assign("project", $tproject);
    $template->assign("done", $done);

    $template->assign("ptasks", $ptasks);
    $template->assign("today", $today);
Пример #18
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(ROOT_PATH . "/apps/" . $_GET['m'] . "/admin/add.php");
_setTitle($langArray['edit']);
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
    refresh('?m=' . $_GET['m'] . '&c=list', 'INVALID ID', 'error');
}
$cms = new tags();
if (isset($_POST['edit'])) {
    $status = $cms->edit($_GET['id']);
    if ($status !== true) {
        abr('error', $status);
    } else {
        refresh("?m=" . $_GET['m'] . "&c=list", $langArray['edit_complete']);
    }
} else {
    $_POST = $cms->get($_GET['id']);
}
require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';
Пример #19
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['list']);
$cms = new tags();
$data = $cms->getAll();
abr('data', $data);
require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';
Пример #20
0
     $execute_query = pmb_mysql_query($rqt);
     while ($r = pmb_mysql_fetch_object($execute_query)) {
         $array_selector[$r->id_mot] = $r->mot;
     }
     pmb_mysql_free_result($execute_query);
     if (count($array_selector)) {
         //dédoublonnage du tableau final
         $array_selector = array_unique($array_selector);
         //tri alphanumérique du tableau
         asort($array_selector);
     }
     $origine = "ARRAY";
     break;
 case 'tags':
     require_once "{$class_path}/tags.class.php";
     $tags = new tags();
     $array_selector = $tags->get_array($start, $pos_cursor);
     $taille_search = $tags->get_taille_search();
     $origine = "ARRAY";
     break;
 case 'perio':
     $requete = "select tit1, notice_id from notices where niveau_biblio='s' and niveau_hierar='1' and tit1 like '" . addslashes($start) . "%' order by 1 limit 20";
     $origine = "SQL";
     break;
 case 'bull':
     $link_bull = " and bulletin_notice ='" . $linkfield . "'";
     $requete = "select bulletin_numero, bulletin_id from bulletins where (bulletin_numero like '" . addslashes($start) . "%' or bulletin_titre like '" . addslashes($start) . "%')  {$link_bull} order by 1 limit 20";
     $origine = "SQL";
     break;
 case 'expl_cote':
     if ($pmb_prefill_cote_ajax) {
Пример #21
0
function old_category_list($lang="en") {
  global $lists_dir;

  if($state=category_check_state()!==true) {
    return array('status'=>$state);
  }

  $ret=array();
  lock_dir($lists_dir);

  $d=opendir("$lists_dir");
  while($f=readdir($d)) {
    if(preg_match("/^(.*)\.xml$/", $f, $m)) {
      $x=new DOMDocument();
      $x->loadXML(file_get_contents("$lists_dir/$f"));
      $tags=new tags();
      $tags->readDOM($x->firstChild);

      //if($tags->get("hide")!="yes") {
	$ret[$m[1]]=$tags;
      //}
    }
  }
  closedir($d);

  unlock_dir($lists_dir);

  return $ret;
}
Пример #22
0
 /**
  * 清空回收站
  */
 public function action_clear()
 {
     $rows = DB::select()->from('imgs')->where('userid', '=', (int) $this->auth['uid'])->where('recycle', '=', 1)->fetch_all();
     if (!empty($rows)) {
         $rows = new Arrayobj($rows);
         foreach ($rows as $row) {
             if ($row->userid == (int) $this->auth['uid']) {
                 // 添加图片到删除缓存表中
                 $url = 'http://' . $row->disk_id . '.wal8.com/';
                 $img_path = $row->disk_name . '/' . $row->picname;
                 $thumb_130 = $this->thumb->create2($img_path, 130, 130);
                 $data = array('img_url' => $url . $thumb_130, 'add_time' => time(), 'uid' => $this->auth['uid']);
                 @unlink(Io::strip(DOCROOT . $thumb_130));
                 $this->squid_img($data);
                 /*$thumb_120 = $thumb->create2($img_path, 120, 120);
                   $data['img_url'] = $url . $thumb_120;
                   $this->squid_img($data);
                   @unlink(Io::strip(DOCROOT.  $thumb_120));*/
                 $thumb_65 = $this->thumb->create2($img_path, 65, 65);
                 $data['img_url'] = $url . $thumb_65;
                 $this->squid_img($data);
                 @unlink(Io::strip(DOCROOT . $thumb_65));
                 $thumb_640 = $this->thumb->create2($img_path, 640, 640, 's');
                 $data['img_url'] = $url . $thumb_640;
                 $this->squid_img($data);
                 @unlink(Io::strip(DOCROOT . $thumb_640));
                 $data['img_url'] = $url . $img_path;
                 $this->squid_img($data);
                 // 删除评论
                 DB::delete('comments')->where('item_id', '=', $row->id)->where('app', '=', 'img')->execute();
                 // 删除图片记录
                 DB::delete('imgs')->where('id', '=', $row->id)->execute();
                 @unlink(Io::strip(DOCROOT . $row->disk_name . '/' . $row->picname));
                 // 删除标签
                 $tag = new tags();
                 $tag->del($row->id, 'app');
             }
         }
     }
     echo 'success';
     //$this->request->redirect('/category/list?recycle=1');
     $this->auto_render = false;
 }
Пример #23
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['add']);
$cms = new tags();
if (isset($_POST['add'])) {
    $status = $cms->add();
    if ($status !== true) {
        abr('error', $status);
    } else {
        refresh("?m=" . $_GET['m'] . "&c=list", $langArray['add_complete']);
    }
}
require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';
Пример #24
0
/**
 * Schickt ein Status-Mail an die Kontaktperson der Bestellung
 * 
 * @param $bestellung Bestellung Object der Bestellung
 * @param $status Art der Statusaenderung (bestellt|geliefert|freigabe|storno)
 */
function sendBestellerMail($bestellung, $status)
{
    global $date;
    $tags = new tags();
    $tags->GetTagsByBestellung($bestellung->bestellung_id);
    $tagsAusgabe = '';
    foreach ($tags->result as $res) {
        if ($tagsAusgabe != '') {
            $tagsAusgabe .= ', ';
        }
        $tagsAusgabe .= $res->tag;
    }
    $msg = '';
    $kst_mail = new wawi_kostenstelle();
    $kst_mail->load($bestellung->kostenstelle_id);
    $firma_mail = new firma();
    $firma_mail->load($bestellung->firma_id);
    $konto_mail = new wawi_konto();
    $konto_mail->load($bestellung->konto_id);
    // E-Mail an Kostenstellenverantwortliche senden
    $email = "Dies ist eine automatisch generierte E-Mail.<br><br>";
    switch ($status) {
        case 'bestellt':
            $email .= " <b>Ihre Bestellung wurde bestellt</b>";
            break;
        case 'geliefert':
            $email .= " <b>Ihre Bestellung wurde geliefert</b><br>Hinweis: Nach erfolgter Lieferung werden Waren ab einem Wert von EUR 250,-- pro Einzelposition inventarisiert. <br>";
            break;
        case 'freigabe':
            $email .= " <b>Ihre Bestellung wurde freigegeben</b>";
            break;
        case 'storno':
            $email .= " <b>Ihre Bestellung wurde storniert</b>";
            break;
    }
    $email .= "<br>";
    $email .= "Kostenstelle: " . $kst_mail->bezeichnung . "<br>";
    $email .= "Bestellnummer: " . $bestellung->bestell_nr . "<br>";
    $email .= "Titel: " . $bestellung->titel . "<br>";
    $email .= "Firma: " . $firma_mail->name . "<br>";
    $email .= "Erstellt am: " . $date->formatDatum($bestellung->insertamum, 'd.m.Y') . "<br>";
    $email .= "Kostenstelle: " . $kst_mail->bezeichnung . "<br>Konto: " . $konto_mail->kurzbz . "<br>";
    $email .= "Tags: " . $tagsAusgabe . "<br>";
    $email .= "Link: <a href='" . APP_ROOT . "index.php?content=bestellung.php&method=update&id={$bestellung->bestellung_id}'>zur Bestellung </a>";
    $mail = new mail($bestellung->besteller_uid . '@' . DOMAIN, 'no-reply', 'Bestellung ' . $bestellung->bestell_nr, 'Bitte sehen Sie sich die Nachricht in HTML Sicht an, um den Link vollständig darzustellen.');
    $mail->setHTMLContent($email);
    if (!$mail->send()) {
        $msg .= '<span class="error">Fehler beim Senden des Mails</span><br />';
    } else {
        $msg .= ' Mail verschickt an ' . $bestellung->besteller_uid . '@' . DOMAIN . '!<br>';
    }
    return $msg;
}
Пример #25
0
 function replaceTags($content, $subscriber, $list, $mailingId, $html, $tags = null)
 {
     global $_MAMBOTS;
     global $_VERSION, $mainframe, $database;
     $joomAca15 = $_VERSION->RELEASE != '1.0' && class_exists('JFactory') ? true : false;
     /*		$content = str_replace('href="mailto:' , '9aca7aca5', $content);  // mailto tag good ones
     		$content = str_replace('@', '9aca4aca1', $content);  // mailto tag good ones */
     $Itemid = $GLOBALS[ACA . 'itemidAca'];
     $listId = $list->id;
     if ($GLOBALS[ACA . 'use_sef'] == '1' and $GLOBALS['mosConfig_sef'] == '1' and function_exists('sefRelToAbs')) {
         $subscriptionslink = sefRelToAbs('index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=change&subscriber=' . $subscriber->id . '&cle=' . md5($subscriber->email) . '&listid=' . $listId);
         $unsubscribelink = sefRelToAbs('index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=unsubscribe&subscriber=' . $subscriber->id . '&cle=' . md5($subscriber->email) . '&listid=' . $listId);
     } else {
         $subscriptionslink = $GLOBALS['mosConfig_live_site'] . '/index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=change&subscriber=' . $subscriber->id . '&cle=' . md5($subscriber->email) . '&listid=' . $listId;
         $unsubscribelink = $GLOBALS['mosConfig_live_site'] . '/index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=unsubscribe&subscriber=' . $subscriber->id . '&cle=' . md5($subscriber->email) . '&listid=' . $listId;
     }
     if ($html) {
         $subscriptionslink = '<a href="' . $subscriptionslink . '" target="_blank"><span class="subscriptionlink_nws">' . _ACA_CHANGE_EMAIL_SUBSCRIPTION . '</span></a>';
         $unsubscribelink = '<a href="' . $unsubscribelink . '" target="_blank"><span class="subscriptionlink_nws">' . _ACA_UNSUBSCRIBE . '</span></a>';
         $subscriptionstext = '<p>' . $subscriptionslink . '<br />' . $unsubscribelink . '</p>';
     } else {
         $subscriptionslink = _ACA_CHANGE_EMAIL_SUBSCRIPTION . ' ( ' . $subscriptionslink . ' )';
         $unsubscribelink = _ACA_UNSUBSCRIBE . ' ( ' . $unsubscribelink . ' )';
         $subscriptionstext = "\r\n" . $subscriptionslink . "\r\n" . $unsubscribelink;
         if (substr_count($content, '[SUBSCRIPTIONS]') < 1) {
             $content .= "\r\n [SUBSCRIPTIONS] \r\n";
         }
     }
     if ($GLOBALS[ACA . 'show_signature'] == 1) {
         if ($html) {
             $signatureText = '<a href="http://www.joobisoft.com" target="_blank">';
             $signatureText .= '<br /><center><span style="color:#666666; font-size: .8em; text-align: center; ">Powered by Joobi</span></center>';
             $signatureText .= '</a>';
         } else {
             $signatureText = 'Powered by Joobi ( http://www.joobisoft.com )';
         }
         $subscriptionstext .= "\r\n\r\n" . $signatureText;
     }
     if ($GLOBALS['mosConfig_sef'] == '1' and $GLOBALS[ACA . 'use_sef'] == '1' and function_exists('sefRelToAbs')) {
         $confirmlink = sefRelToAbs('index.php?option=com_acajoom&act=confirm&listid=' . $listId . '&cle=' . md5($subscriber->email) . '&subscriber=' . $subscriber->id);
     } else {
         $confirmlink = $GLOBALS['mosConfig_live_site'] . '/index.php?option=com_acajoom&act=confirm&listid=' . $listId . '&cle=' . md5($subscriber->email) . '&subscriber=' . $subscriber->id;
     }
     if ($html) {
         $confirmlink = '<a href="' . $confirmlink . '" target="_blank">' . _ACA_CONFIRM_LINK . '</a>';
     } else {
         $confirmlink = _ACA_CONFIRM_LINK . "\n" . $confirmlink;
     }
     $tname = explode(" ", $subscriber->name);
     $firstname = $tname[0];
     $content = str_replace('[CONFIRM]', $confirmlink, $content);
     $content = str_replace('[NAME]', $subscriber->name, $content);
     $content = str_replace('[FIRSTNAME]', $firstname, $content);
     if (class_exists('auto')) {
         auto::tags($content, $tags);
     }
     if ($list->footer == '0') {
         $content = str_replace('[SUBSCRIPTIONS]', '', $content);
     } else {
         $content = str_replace('[SUBSCRIPTIONS]', $subscriptionstext, $content);
     }
     if (class_exists('tags') and $tags) {
         tags::replace($content, $tags);
     }
     if (!empty($mailingId) and $GLOBALS[ACA . 'enable_statistics'] == 1) {
         if ($GLOBALS[ACA . 'statistics_per_subscriber'] == 1) {
             if ($html) {
                 $content .= '<img src="' . $GLOBALS['mosConfig_live_site'] . '/index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=log&listid=' . $listId . '&mailingid=' . $mailingId . '&subscriber=' . $subscriber->id . '" border="0" width="1" height="1" />';
             }
         } else {
             if ($html) {
                 $content .= '<img src="' . $GLOBALS['mosConfig_live_site'] . '/index.php?option=com_acajoom&Itemid=' . $Itemid . '&act=log&listid=' . $listId . '&mailingid=' . $mailingId . '" border="0" width="1" height="1" />';
             }
         }
     }
     // replace for images
     //  put the good mailto tag back (replaced before the content mambot)
     $replaceTag = array('href="mailto:', '@', 'href="#');
     $replaceBy = array('9aca7aca5', '9aca4aca1', '9aca12aca3');
     $content = str_replace($replaceTag, $replaceBy, $content);
     $content = preg_replace('#src[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'src="' . $GLOBALS['mosConfig_live_site'] . '/', $content);
     $content = preg_replace('#href[ ]*=[ ]*\\"(?!https?://)(?:\\.\\./|\\./|/)?#', 'href="' . $GLOBALS['mosConfig_live_site'] . '/', $content);
     $content = str_replace($replaceBy, $replaceTag, $content);
     $content = preg_replace('#\\.(jpg|gif|jpeg|png)(?:(?!").)?"#', '.\\1"', $content);
     if (!$html) {
         $content = str_replace('&amp;', '&', $content);
     }
     if ($html) {
         $textonly = '';
         acajoom_mail::replaceClass($content, $textonly);
     }
     return $content;
 }
Пример #26
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
define('USING_LANGUAGE', false);
require_once '../../../config.php';
require_once $config['root_path'] . '/core/functions.php';
include_once $config['system_core'] . "/initEngine.php";
admin_login();
if (isset($_POST['deleteKey']) && isset($_POST['id']) && isset($_SESSION['user']['access']['tags'])) {
    require_once ROOT_PATH . "/apps/tags/models/tags.class.php";
    $cms = new tags();
    $cms->delete(intval($_POST['id']));
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
}
echo json_encode(array_merge($_POST, array('status' => 'unknown error')));
die;
Пример #27
0
 public static function deleteWebPage($pack)
 {
     $webpage = dbconnection::queryObject("SELECT * FROM web_pages WHERE web_page_id = '{$pack->web_page_id}'");
     $pack->auth->game_id = $webpage->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM web_pages WHERE web_page_id = '{$pack->web_page_id}' LIMIT 1");
     //cleanup
     $options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE link_type = 'EXIT_TO_WEB_PAGE' AND link_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($options); $i++) {
         $pack->dialog_option_id = $options[$i]->dialog_option_id;
         dialogs::deleteDialogOption($pack);
     }
     $tabs = dbconnection::queryArray("SELECT * FROM tabs WHERE type = 'WEB_PAGE' AND content_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($tabs); $i++) {
         $pack->tab_id = $tabs[$i]->tab_id;
         tabs::deleteTab($pack);
     }
     $tags = dbconnection::queryArray("SELECT * FROM object_tags WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($tags); $i++) {
         $pack->object_tag_id = $tags[$i]->object_tag_id;
         tags::deleteObjectTag($pack);
     }
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::deleteInstance($pack);
     }
     $factories = dbconnection::queryArray("SELECT * FROM factories WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($factories); $i++) {
         $pack->factory_id = $factories[$i]->factory_id;
         factories::deleteFactory($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_VIEWED_WEB_PAGE' AND content_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
Пример #28
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
$tag_type = get_id(2);
$tag = get_id(3);
require_once ROOT_PATH . '/apps/tags/models/tags.class.php';
$tagsClass = new tags();
_setTitle($tag);
$t = $tagsClass->isExistTag($tag);
if (is_array($t)) {
    $itemsClass = new items();
    #加载书签集作品
    $limit = 20;
    $start = (PAGE - 1) * $limit;
    $order = '';
    if (!isset($_GET['sort_by'])) {
        $_GET['sort_by'] = '';
    }
    switch ($_GET['sort_by']) {
        case 'name':
            $order = '`name`';
            break;
Пример #29
0
 /**
  * Get
  *
  * @param  string $string content to scan
  *
  * @return string returns modified content
  */
 public static function get($string)
 {
     //current year
     $string = str_replace('[year]', date('Y'), $string);
     //name of website
     $string = str_replace('[sitetitle]', SITETITLE, $string);
     //site email address
     $string = str_replace('[siteemail]', SITEEMAIL, $string);
     //feedburner subscribe form
     $string = preg_replace_callback("(\\[feedburner(.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         $username = isset($params['username']) ? $params['username'] : '';
         $form = "<form action='https://feedburner.google.com/fb/a/mailverify' method='post' target='popupwindow' onsubmit='window.open('http://feedburner.google.com/fb/a/mailverify?uri={$username}', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true' class='navbar-form'>\n            <input type='hidden' value='{$username}' name='uri'>\n            <input type='hidden' name='loc' value='en_US'>\n              <p><input type='text' class='form-control' placeholder='Enter Email Address' name='email' id='srch-term'></p>\n              <p><input class='btn btn-success' type='submit' value='Subscribe by Email'></p>\n            </form>";
         return $form;
     }, $string);
     //google plus box
     $string = preg_replace_callback("(\\[googleplusbox(.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         $username = isset($params['username']) ? $params['username'] : '';
         return "<script src='https://apis.google.com/js/platform.js' async defer></script>\n                    <g:page href='https://plus.google.com/+{$username}'></g:page>";
     }, $string);
     //twitter follow button
     $string = preg_replace_callback("(\\[twitterfollowbutton(.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         if (!isset($params['count'])) {
             $params['count'] = null;
         }
         if (!isset($params['size'])) {
             $params['size'] = null;
         }
         //if key exits use it
         $username = isset($params['username']) ? $params['username'] : '';
         $count = $params['count'] == 'no' ? "data-show-count='false'" : '';
         $size = $params['size'] == 'large' ? "data-size='large'" : '';
         return "<a href='https://twitter.com/{$username}' class='twitter-follow-button' {$count} {$size}>Follow @{$username}</a>\n        <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>";
     }, $string);
     //twitter share button
     $string = preg_replace_callback("(\\[twittersharebutton(.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         if (!isset($params['count'])) {
             $params['count'] = null;
         }
         if (!isset($params['size'])) {
             $params['size'] = null;
         }
         //if key exits use it
         $count = $params['count'] == 'no' ? "data-count='none'" : '';
         $size = $params['size'] == 'large' ? "data-size='large'" : '';
         $via = isset($params['via']) ? "data-via='{$params['via']}'" : '';
         $hash = isset($params['hash']) ? "data-hashtags='{$params['hash']}'" : '';
         return "<a href='https://twitter.com/share' class='twitter-share-button' {$count} {$size} {$via} {$hash}>Tweet</a>\n        <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>";
     }, $string);
     //youtube embeds
     $string = preg_replace_callback("(\\[youtube (.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         //if key exits use it
         $video = isset($params['video']) ? $params['video'] : '';
         $video = str_replace("https://www.youtube.com/watch?v=", "", $video);
         $width = isset($params['width']) ? $params['width'] : '640';
         $height = isset($params['height']) ? $params['height'] : '360';
         return "<iframe width='{$width}' height='{$height}' src='//www.youtube.com/embed/{$video}' frameborder='0' allowfullscreen></iframe>";
     }, $string);
     //youtube subscribe
     $string = preg_replace_callback("(\\[youtubesub(.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         if (!isset($params['count'])) {
             $params['count'] = null;
         }
         if (!isset($params['size'])) {
             $params['size'] = null;
         }
         $username = isset($params['username']) ? $params['username'] : '';
         $layout = $params['layout'] == 'full' ? 'full' : 'default';
         $count = $params['count'] == 'no' ? 'hidden' : 'default';
         return "<script src='https://apis.google.com/js/platform.js'></script>\n                <div class='g-ytsubscribe' data-channel='{$username}' data-layout='{$layout}' data-count='{$count}'></div>";
     }, $string);
     //vimeo embeds
     $string = preg_replace_callback("(\\[vimeo (.*?)])is", function ($matches) {
         $params = tags::clean($matches);
         //if key exits use it
         $video = isset($params['video']) ? $params['video'] : '';
         $video = str_replace("https://vimeo.com/", "", $video);
         $width = isset($params['width']) ? $params['width'] : '640';
         $height = isset($params['height']) ? $params['height'] : '360';
         return "<iframe width='{$width}' height='{$height}' src='https://player.vimeo.com/video/{$video}' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
     }, $string);
     return $string;
 }
Пример #30
0
<?php

require "./init.php";
$tagobj = new tags();
$pro = new project();
$action = getArrayVal($_GET, "action");
$mid = getArrayVal($_GET, "mid");
$tag = getArrayVal($_GET, "tag");
$tag = urldecode($tag);
$id = getArrayVal($_GET, "id");
$mode = getArrayVal($_GET, "mode");
$template->assign("mode", $mode);
$start = getArrayVal($_GET, "start");
$end = getArrayVal($_GET, "end");
if ($action == "gettag") {
    $content = $tagobj->getTagContent($tag, $id);
    $num = count($content);
    $thetag = strip_tags($tag);
    $template->assign("thetag", $thetag);
    $template->assign("num", $num);
    $template->assign("title", $thetag);
    $template->assign("result", $content);
    $template->display("tag.tpl");
}