Example #1
0
function get_user_info($result)
{
    /* starting from one of the results gotten from search_users()
     * we can build an array with the actual user information
     * by calling get_item() to extract the single LDAP items.
     * this data will end up in the main foreach() in index.php
     * which will display $key=>$value in a nice table,
     * that's why we're doing some HTML here (yes it's ugly but...)
     */
    $user_info['Picture'] = "<img src=" . get_picture($result) . " class=\"img-responsive\">";
    $user_info['Name'] = get_ldap_item("cn", $result);
    $user_info['Title'] = get_ldap_item("title", $result);
    if (get_ldap_item("mail", $result) != "") {
        // doing some more checks on this one or we'll return invalid HTML
        $user_info['Internet Email'] = "<a href=\"mailto:" . get_ldap_item("mail", $result) . "\">" . get_ldap_item("mail", $result) . "</a>";
    }
    if (get_ldap_item("othermailbox", $result) != "") {
        // as above, also can't use empty() for PHP 5.4 compatibility
        $user_info['Personal Email'] = "<a href=\"mailto:" . get_ldap_item("othermailbox", $result) . "\">" . get_ldap_item("othermailbox", $result) . "</a>";
    }
    $user_info['Phone'] = get_ldap_item("telephonenumber", $result);
    $user_info['Mobile'] = get_ldap_item("mobile", $result);
    $user_info['Extension (Global)'] = get_ldap_item("pager", $result);
    $user_info['Address'] = get_ldap_item("street", $result) . " " . get_ldap_item("postalcode", $result) . " " . get_ldap_item("l", $result) . " " . get_ldap_item("st", $result);
    $user_info['Manager'] = "dn: " . get_ldap_item("manager", $result);
    $user_info['Uid'] = get_ldap_item("uid", $result);
    $user_info['Posix User'] = "******" . get_ldap_item("uid", $result) . " - uid: " . get_ldap_item("uidnumber", $result) . " - gid: " . get_ldap_item("gidnumber", $result) . " - shell: " . get_ldap_item("loginshell", $result);
    // we're exploiting array_filter to clean up empty entries
    // so that we don't have ugly empty rows in the search results table
    $user_info = array_filter($user_info);
    return $user_info;
}
Example #2
0
function main_f()
{
    if (isset($_SERVER['HTTP_REFERER'])) {
        $ar = get_words($_SERVER['HTTP_REFERER']);
        connect();
        if (count($ar) > 0) {
            foreach (array_reverse($ar, true) as $key => $val) {
                $sres = sql("select picture, name from ln_product where name like '%" . $key . "%' and picture is not null order by rating desc limit 0,1");
                if ($ar_res = mysql_fetch_assoc($sres)) {
                    //write_log($key);
                    get_picture($ar_res['picture']);
                    break;
                }
            }
        }
        disconnect();
    }
}
Example #3
0
                                  <th><?php 
                _e("Total");
                ?>
</th>
                                </tr>
                              </thead>
                              <tbody>
                                <?php 
                foreach ($cart_items as $cart_item) {
                    ?>
                                <tr class="mw-order-item mw-order-item-1">
                                  <td class="mw-order-item-image" width="35">


                <?php 
                    $p = get_picture($cart_item['rel_id']);
                    ?>
                <?php 
                    if ($p != false) {
                        ?>
                <span class="bgimg" style="width: 35px;height:35px;background-image:url(<?php 
                        print thumbnail($p, 120, 120);
                        ?>
);"></span>

                <?php 
                    }
                    ?>


Example #4
0
 /**
  * Print nested tree of pages.
  *
  * @example
  * <pre>
  * // Example Usage:
  * $pt_opts = array();
  * $pt_opts['link'] = "{title}";
  * $pt_opts['list_tag'] = "ol";
  * $pt_opts['list_item_tag'] = "li";
  * pages_tree($pt_opts);
  * </pre>
  * @example
  * <pre>
  * // Example Usage to make <select> with <option>:
  * $pt_opts = array();
  * $pt_opts['link'] = "{title}";
  * $pt_opts['list_tag'] = " ";
  * $pt_opts['list_item_tag'] = "option";
  * $pt_opts['active_ids'] = $data['parent'];
  * $pt_opts['active_code_tag'] = '   selected="selected"  ';
  * $pt_opts['ul_class'] = 'nav';
  * $pt_opts['li_class'] = 'nav-item';
  *  pages_tree($pt_opts);
  * </pre>
  * @example
  * <pre>
  * // Other options
  * $pt_opts['parent'] = "8";
  * $pt_opts['include_first'] =  true; //includes the parent in the tree
  * $pt_opts['id_prefix'] = 'my_id';
  * </pre>
  *
  * @param int $parent
  * @param bool $link
  * @param bool $active_ids
  * @param bool $active_code
  * @param bool $remove_ids
  * @param bool $removed_ids_code
  * @param bool $ul_class_name
  * @param bool $include_first
  *
  * @return sting Prints the pages tree
  */
 public function pages_tree($parent = 0, $link = false, $active_ids = false, $active_code = false, $remove_ids = false, $removed_ids_code = false, $ul_class_name = false, $include_first = false)
 {
     $params2 = array();
     $params = false;
     $output = '';
     if (is_integer($parent)) {
     } else {
         $params = $parent;
         if (is_string($params)) {
             $params = parse_str($params, $params2);
             $params = $params2;
             extract($params);
         }
         if (is_array($params)) {
             $parent = 0;
             extract($params);
         }
     }
     if (!defined('CONTENT_ID')) {
         $this->define_constants();
     }
     $cache_id_params = $params;
     if (isset($cache_id_params['link']) and is_callable($cache_id_params['link'])) {
         unset($cache_id_params['link']);
         $params['no_cache'] = true;
     }
     $function_cache_id = false;
     $args = func_get_args();
     foreach ($args as $k => $v) {
         $function_cache_id = $function_cache_id . serialize($k) . serialize($v);
     }
     $function_cache_id = $function_cache_id . serialize($cache_id_params);
     $function_cache_id = __FUNCTION__ . crc32($function_cache_id) . PAGE_ID . $parent;
     if ($parent == 0) {
         $cache_group = 'content/global';
     } else {
         $cache_group = 'categories/global';
     }
     if (isset($include_categories) and $include_categories == true) {
         $cache_group = 'categories/global';
     }
     $nest_level = 0;
     if (isset($params['nest_level'])) {
         $nest_level = $params['nest_level'];
     }
     $nest_level_orig = $nest_level;
     //$params['no_cache'] = 1;
     if ($nest_level_orig == 0) {
         $cache_content = $this->app->cache_manager->get($function_cache_id, $cache_group);
         if (isset($params['no_cache'])) {
             $cache_content = false;
         }
         // $cache_content = false;
         if ($cache_content != false) {
             if (isset($params['return_data'])) {
                 return $cache_content;
             } else {
                 echo $cache_content;
             }
             return;
         }
     }
     $nest_level = 0;
     if (isset($params['nest_level'])) {
         $nest_level = $params['nest_level'];
     }
     if (isset($params['parent'])) {
         $params['parent'] = intval($params['parent']);
     }
     if (isset($params['id'])) {
         unset($params['id']);
     }
     $max_level = false;
     if (isset($params['max_level'])) {
         $max_level = $params['max_level'];
     } elseif (isset($params['maxdepth'])) {
         $max_level = $params['max_level'] = $params['maxdepth'];
     } elseif (isset($params['depth'])) {
         $max_level = $params['max_level'] = $params['depth'];
     }
     if ($max_level != false) {
         if (intval($nest_level) >= intval($max_level)) {
             echo '';
             return;
         }
     }
     $is_shop = '';
     if (isset($params['is_shop'])) {
         if ($params['is_shop'] == 'y') {
             $params['is_shop'] = 1;
         } elseif ($params['is_shop'] == 'n') {
             $params['is_shop'] = 0;
         }
         $is_shop = $this->app->database_manager->escape_string($params['is_shop']);
         $is_shop = " and is_shop='{$is_shop} '";
         $include_first = false;
     }
     $ul_class = 'pages_tree';
     if (isset($params['ul_class'])) {
         $ul_class_name = $ul_class = $params['ul_class'];
     }
     $content_link_class = 'mw-tree-content-link';
     if (isset($params['content_link_class'])) {
         $content_link_class = $params['content_link_class'];
     }
     $li_class = 'pages_tree_item';
     if (isset($params['li_class'])) {
         $li_class = $params['li_class'];
     }
     if (isset($params['ul_tag'])) {
         $list_tag = $params['ul_tag'];
     }
     if (isset($params['li_tag'])) {
         $list_item_tag = $params['li_tag'];
     }
     if (isset($params['include_categories'])) {
         $include_categories = $params['include_categories'];
     }
     $include_all_content = false;
     if (isset($params['include_all_content'])) {
         $include_all_content = $params['include_all_content'];
     }
     ob_start();
     $table = $this->tables['content'];
     $par_q = '';
     if ($parent == false) {
         $parent = 0;
     } else {
         $parent = intval($parent);
         $par_q = " parent={$parent}    and  ";
     }
     if ($include_first == true) {
         $content_type_q = " and content_type='page'  ";
         if ($include_all_content) {
             $content_type_q = ' ';
         }
         $sql = "SELECT * from {$table} where  id={$parent}    and   is_deleted=0 " . $content_type_q . $is_shop . '  order by position desc  limit 0,1';
     } else {
         $content_type_q = "  content_type='page'  ";
         if ($include_all_content) {
             $content_type_q = ' ';
         }
         $sql = "SELECT * from {$table} where  " . $par_q . $content_type_q . "   and   is_deleted=0 {$is_shop}  order by position desc limit 0,100";
     }
     $cid = __FUNCTION__ . crc32($sql);
     $cidg = 'content/' . $parent;
     if (!is_array($params)) {
         $params = array();
     }
     if (isset($append_to_link) == false) {
         $append_to_link = '';
     }
     if (isset($id_prefix) == false) {
         $id_prefix = '';
     }
     if (isset($link) == false) {
         $link = '<span data-page-id="{id}" class="pages_tree_link {nest_level} {active_class} {active_parent_class}" href="{link}' . $append_to_link . '">{title}</span>';
     }
     if (isset($list_tag) == false) {
         $list_tag = 'ul';
     }
     if (isset($active_code_tag) == false) {
         $active_code_tag = '';
     }
     if (isset($list_item_tag) == false) {
         $list_item_tag = 'li';
     }
     if (isset($params['remove_ids'])) {
         $remove_ids = $params['remove_ids'];
     }
     if (isset($remove_ids) and is_string($remove_ids)) {
         $remove_ids = explode(',', $remove_ids);
     }
     if (isset($active_ids)) {
         $active_ids = $active_ids;
     }
     if (isset($active_ids) and is_string($active_ids)) {
         $active_ids = explode(',', $active_ids);
         if (is_array($active_ids) == true) {
             foreach ($active_ids as $idk => $idv) {
                 $active_ids[$idk] = intval($idv);
             }
         }
     }
     $the_active_class = 'active';
     if (isset($params['active_class'])) {
         $the_active_class = $params['active_class'];
     }
     if (!$include_all_content) {
         $params['content_type'] = 'page';
     }
     $include_first_set = false;
     if ($include_first == true) {
         $include_first_set = 1;
         $include_first = false;
         $include_first_set = $parent;
         if (isset($params['include_first'])) {
             unset($params['include_first']);
         }
     } else {
         $params['parent'] = $parent;
     }
     if (isset($params['is_shop']) and $params['is_shop'] == 1) {
         if (isset($params['parent']) and $params['parent'] == 0) {
             unset($params['parent']);
         }
         if (isset($params['parent']) and $params['parent'] == 'any') {
             unset($params['parent']);
         }
     } else {
         if (isset($params['parent']) and $params['parent'] == 'any') {
             $params['parent'] = 0;
         }
     }
     $params['limit'] = 500;
     $params['orderby'] = 'position desc';
     $params['curent_page'] = 1;
     $params['is_deleted'] = 0;
     $params['cache_group'] = false;
     $params['no_cache'] = true;
     $skip_pages_with_no_categories = false;
     $skip_pages_from_tree = false;
     if (isset($params['skip_sub_pages']) and $params['skip_sub_pages'] != '') {
         $skip_pages_from_tree = $params['skip_sub_pages'];
     }
     if (isset($params['skip-static-pages']) and $params['skip-static-pages'] != false) {
         $skip_pages_with_no_categories = 1;
     }
     $params2 = $params;
     if (isset($params2['id'])) {
         unset($params2['id']);
     }
     if (isset($params2['link'])) {
         unset($params2['link']);
     }
     if ($include_first_set != false) {
         $q = $this->get('id=' . $include_first_set);
     } else {
         $q = $this->get($params2);
     }
     $result = $q;
     if (is_array($result) and !empty($result)) {
         ++$nest_level;
         if (trim($list_tag) != '') {
             if ($ul_class_name == false) {
                 echo "<{$list_tag} class='pages_tree depth-{$nest_level}'>";
             } else {
                 echo "<{$list_tag} class='{$ul_class_name} depth-{$nest_level}'>";
             }
         }
         $res_count = 0;
         foreach ($result as $item) {
             if (is_array($item) != false and isset($item['title']) and $item['title'] != null) {
                 $skip_me_cause_iam_removed = false;
                 if (is_array($remove_ids) == true) {
                     foreach ($remove_ids as $idk => $idv) {
                         $remove_ids[$idk] = intval($idv);
                     }
                     if (in_array($item['id'], $remove_ids)) {
                         $skip_me_cause_iam_removed = true;
                     }
                 }
                 if ($skip_pages_with_no_categories == true) {
                     if (isset($item['subtype']) and $item['subtype'] != 'dynamic') {
                         $skip_me_cause_iam_removed = true;
                     }
                 }
                 if ($skip_me_cause_iam_removed == false) {
                     $output = $output . $item['title'];
                     $content_type_li_class = false;
                     switch ($item['subtype']) {
                         case 'dynamic':
                             $content_type_li_class = 'have_category';
                             break;
                         case 'module':
                             $content_type_li_class = 'is_module';
                             break;
                         default:
                             $content_type_li_class = 'is_page';
                             break;
                     }
                     if (isset($item['layout_file']) and stristr($item['layout_file'], 'blog')) {
                         $content_type_li_class .= ' is_blog';
                     }
                     if ($item['is_home'] == 1) {
                         $content_type_li_class .= ' is_home';
                     }
                     $st_str = '';
                     $st_str2 = '';
                     $st_str3 = '';
                     if (isset($item['subtype']) and trim($item['subtype']) != '') {
                         $st_str = " data-subtype='{$item['subtype']}' ";
                     }
                     if (isset($item['subtype_value']) and trim($item['subtype_value']) != '') {
                         $st_str2 = " data-subtype-value='{$item['subtype_value']}' ";
                     }
                     if (isset($item['is_shop']) and trim($item['is_shop']) == 1) {
                         $st_str3 = ' data-is-shop=true ';
                         $content_type_li_class .= ' is_shop';
                     }
                     $iid = $item['id'];
                     $to_pr_2 = "<{$list_item_tag} class='{$li_class} {$content_type_li_class} {active_class} {active_parent_class} depth-{$nest_level} item_{$iid} {exteded_classes} menu-item-id-{$item['id']}' data-page-id='{$item['id']}' value='{$item['id']}'  data-item-id='{$item['id']}'  {active_code_tag} data-parent-page-id='{$item['parent']}' {$st_str} {$st_str2} {$st_str3}  title='" . addslashes($item['title']) . "' >";
                     if ($link != false) {
                         $active_parent_class = '';
                         if (intval($item['parent']) != 0 and intval($item['parent']) == intval(MAIN_PAGE_ID)) {
                             $active_parent_class = 'active-parent';
                         } elseif (intval($item['id']) == intval(MAIN_PAGE_ID)) {
                             $active_parent_class = 'active-parent';
                         } else {
                             $active_parent_class = '';
                         }
                         if ($item['id'] == CONTENT_ID) {
                             $active_class = 'active';
                         } elseif (isset($active_ids) and !is_array($active_ids) and $item['id'] == $active_ids) {
                             $active_class = 'active';
                         }
                         if (isset($active_ids) and is_array($active_ids) and in_array($item['id'], $active_ids)) {
                             $active_class = 'active';
                         } elseif ($item['id'] == PAGE_ID) {
                             $active_class = 'active';
                         } elseif ($item['id'] == POST_ID) {
                             $active_class = 'active';
                         } elseif (CATEGORY_ID != false and intval($item['subtype_value']) != 0 and $item['subtype_value'] == CATEGORY_ID) {
                             $active_class = 'active';
                         } else {
                             $active_class = '';
                         }
                         $ext_classes = '';
                         if ($res_count == 0) {
                             $ext_classes .= ' first-child ';
                             $ext_classes .= ' child-' . $res_count . '';
                         } elseif (!isset($result[$res_count + 1])) {
                             $ext_classes .= ' last-child';
                             $ext_classes .= ' child-' . $res_count . '';
                         } else {
                             $ext_classes .= ' child-' . $res_count . '';
                         }
                         if (isset($item['parent']) and intval($item['parent']) > 0) {
                             $ext_classes .= ' have-parent';
                         }
                         if (isset($item['subtype_value']) and intval($item['subtype_value']) != 0) {
                             $ext_classes .= ' have-category';
                         }
                         if (isset($item['is_active']) and $item['is_active'] == 'n') {
                             $ext_classes = $ext_classes . ' content-unpublished ';
                         }
                         $ext_classes = trim($ext_classes);
                         $the_active_class = $active_class;
                         if (is_callable($link)) {
                             $to_print = call_user_func_array($link, array($item));
                         } else {
                             $to_print = $link;
                         }
                         $to_print = str_replace('{id}', $item['id'], $to_print);
                         $to_print = str_replace('{active_class}', $active_class, $to_print);
                         $to_print = str_replace('{active_parent_class}', $active_parent_class, $to_print);
                         $to_print = str_replace('{exteded_classes}', $ext_classes, $to_print);
                         $to_pr_2 = str_replace('{exteded_classes}', $ext_classes, $to_pr_2);
                         $to_pr_2 = str_replace('{active_class}', $active_class, $to_pr_2);
                         $to_pr_2 = str_replace('{active_parent_class}', $active_parent_class, $to_pr_2);
                         $to_print = str_replace('{title}', $item['title'], $to_print);
                         $to_print = str_replace('{nest_level}', 'depth-' . $nest_level, $to_print);
                         $to_print = str_replace('{content_link_class}', $content_link_class, $to_print);
                         if (strstr($to_print, '{link}')) {
                             $to_print = str_replace('{link}', page_link($item['id']), $to_print);
                         }
                         $empty1 = intval($nest_level);
                         $empty = '';
                         for ($i1 = 0; $i1 < $empty1; ++$i1) {
                             $empty = $empty . '&nbsp;&nbsp;';
                         }
                         $to_print = str_replace('{empty}', $empty, $to_print);
                         if (strstr($to_print, '{tn}')) {
                             $content_img = get_picture($item['id']);
                             if ($content_img) {
                                 $to_print = str_replace('{tn}', $content_img, $to_print);
                             } else {
                                 $to_print = str_replace('{tn}', '', $to_print);
                             }
                         }
                         foreach ($item as $item_k => $item_v) {
                             $to_print = str_replace('{' . $item_k . '}', $item_v, $to_print);
                         }
                         ++$res_count;
                         if (isset($active_ids) and is_array($active_ids) == true) {
                             $is_there_active_ids = false;
                             foreach ($active_ids as $active_id) {
                                 if (intval($item['id']) == intval($active_id)) {
                                     $is_there_active_ids = true;
                                     $to_print = str_ireplace('{active_code}', $active_code, $to_print);
                                     $to_print = str_ireplace('{active_class}', $the_active_class, $to_print);
                                     $to_pr_2 = str_ireplace('{active_class}', $the_active_class, $to_pr_2);
                                     $to_pr_2 = str_ireplace('{active_code_tag}', $active_code_tag, $to_pr_2);
                                 }
                             }
                         } elseif (isset($active_ids) and !is_array($active_ids)) {
                             if (intval($item['id']) == intval($active_ids)) {
                                 $is_there_active_ids = true;
                                 $to_print = str_ireplace('{active_code}', $active_code, $to_print);
                                 $to_print = str_ireplace('{active_class}', $the_active_class, $to_print);
                                 $to_pr_2 = str_ireplace('{active_class}', $the_active_class, $to_pr_2);
                                 $to_pr_2 = str_ireplace('{active_code_tag}', $active_code_tag, $to_pr_2);
                             }
                         }
                         $to_print = str_ireplace('{active_code}', '', $to_print);
                         $to_print = str_ireplace('{active_class}', '', $to_print);
                         $to_pr_2 = str_ireplace('{active_class}', '', $to_pr_2);
                         $to_pr_2 = str_ireplace('{active_code_tag}', '', $to_pr_2);
                         $to_pr_2 = str_ireplace('{content_link_class}', '', $to_pr_2);
                         $to_print = str_replace('{exteded_classes}', '', $to_print);
                         $to_print = str_replace('{content_link_class}', '', $to_print);
                         if ($item['id'] == $item['parent']) {
                             $remove_ids[] = intval($item['id']);
                         }
                         if (is_array($remove_ids) == true) {
                             if (in_array($item['id'], $remove_ids)) {
                                 if ($removed_ids_code == false) {
                                     $to_print = false;
                                 } else {
                                     $remove_ids[] = intval($item['id']);
                                     $to_print = str_ireplace('{removed_ids_code}', $removed_ids_code, $to_print);
                                 }
                             } else {
                                 $to_print = str_ireplace('{removed_ids_code}', '', $to_print);
                             }
                         }
                         $to_pr_2 = str_replace('{active_class}', '', $to_pr_2);
                         $to_pr_2 = str_replace('{exteded_classes}', '', $to_pr_2);
                         echo $to_pr_2;
                         $to_pr_2 = false;
                         echo $to_print;
                     } else {
                         $to_pr_2 = str_ireplace('{active_class}', '', $to_pr_2);
                         $to_pr_2 = str_replace('{exteded_classes}', '', $to_pr_2);
                         $to_pr_2 = str_replace('{active_parent_class}', '', $to_pr_2);
                         echo $to_pr_2;
                         $to_pr_2 = false;
                         echo $item['title'];
                     }
                     if (is_array($params)) {
                         $params['parent'] = $item['id'];
                         if ($max_level != false) {
                             $params['max_level'] = $max_level;
                         }
                         if (isset($params['is_shop'])) {
                             unset($params['is_shop']);
                         }
                         //   $nest_level++;
                         $params['nest_level'] = $nest_level;
                         $params['ul_class_name'] = false;
                         $params['ul_class'] = false;
                         if (isset($include_categories)) {
                             $params['include_categories'] = $include_categories;
                         }
                         if (isset($params['ul_class_deep'])) {
                             $params['ul_class'] = $params['ul_class_deep'];
                         }
                         if (isset($maxdepth)) {
                             $params['maxdepth'] = $maxdepth;
                         }
                         if (isset($params['li_class_deep'])) {
                             $params['li_class'] = $params['li_class_deep'];
                         }
                         if (isset($params['return_data'])) {
                             unset($params['return_data']);
                         }
                         $params['remove_ids'] = $remove_ids;
                         if ($skip_pages_from_tree == false) {
                             if ($item['id'] != $item['parent']) {
                                 $children = $this->pages_tree($params);
                             }
                         }
                     } else {
                         if ($skip_pages_from_tree == false) {
                             if ($item['id'] != $item['parent']) {
                                 $children = $this->pages_tree(intval($item['id']), $link, $active_ids, $active_code, $remove_ids, $removed_ids_code, $ul_class_name = false);
                             }
                         }
                     }
                     if (isset($include_categories) and $include_categories == true) {
                         $content_cats = array();
                         if (isset($item['subtype_value']) and intval($item['subtype_value']) == true) {
                         }
                         $cat_params = array();
                         if (isset($item['subtype_value']) and intval($item['subtype_value']) != 0) {
                             //$cat_params['subtype_value'] = $item['subtype_value'];
                         }
                         //$cat_params['try_rel_id'] = $item['id'];
                         if (isset($categores_link)) {
                             $cat_params['link'] = $categores_link;
                         } else {
                             $cat_params['link'] = $link;
                         }
                         if (isset($categories_active_ids)) {
                             $cat_params['active_ids'] = $categories_active_ids;
                         }
                         if (isset($categories_removed_ids)) {
                             $cat_params['remove_ids'] = $categories_removed_ids;
                         }
                         if (isset($active_code)) {
                             $cat_params['active_code'] = $active_code;
                         }
                         //$cat_params['for'] = 'content';
                         $cat_params['list_tag'] = $list_tag;
                         $cat_params['list_item_tag'] = $list_item_tag;
                         $cat_params['rel_type'] = 'content';
                         $cat_params['rel_id'] = $item['id'];
                         $cat_params['include_first'] = 1;
                         $cat_params['nest_level'] = $nest_level;
                         if ($max_level != false) {
                             $cat_params['max_level'] = $max_level;
                         }
                         if ($nest_level > 1) {
                             if (isset($params['ul_class_deep'])) {
                                 $cat_params['ul_class'] = $params['ul_class_deep'];
                             }
                             if (isset($params['li_class_deep'])) {
                                 $cat_params['li_class'] = $params['li_class_deep'];
                             }
                         } else {
                             if (isset($params['ul_class'])) {
                                 $cat_params['ul_class'] = $params['ul_class'];
                             }
                             if (isset($params['li_class'])) {
                                 $cat_params['li_class'] = $params['li_class'];
                             }
                         }
                         $this->app->category_manager->tree($cat_params);
                     }
                 }
                 echo "</{$list_item_tag}>";
             }
         }
         if (trim($list_tag) != '') {
             echo "</{$list_tag}>";
         }
     }
     $content = ob_get_contents();
     if ($nest_level_orig == 0) {
         $this->app->cache_manager->save($content, $function_cache_id, $cache_group);
     }
     ob_end_clean();
     if (isset($params['return_data'])) {
         return $content;
     } else {
         echo $content;
     }
     return false;
 }
Example #5
0
if (!isset($parent) or $parent == '') {
    $parent = 0;
}
$cats = get_categories('order_by=position asc&parent_id=' . $parent);
?>

<div class="categories-posts categories-posts-big mw-open-module-settings">
  <?php 
if ($cats != false) {
    foreach ($cats as $cat) {
        $latest_product = get_content("order_by=position desc&category=" . $cat['id']);
        if (isset($latest_product[0]) == false) {
            continue;
        }
        $latest_product = $latest_product[0];
        $pic = get_picture($latest_product['id']);
        ?>
  <a href="<?php 
        print category_link($cat['id']);
        ?>
"> <span class="bgimg" style="background-image: url(<?php 
        print thumbnail($pic, 1100, 1100);
        ?>
);"></span> <strong><?php 
        print $cat['title'];
        ?>
</strong> </a>
  <?php 
    }
} else {
    print lnotif('Select category');
Example #6
0
    echo date("F", strtotime($item['updated_at']));
    ?>
</span></time>
                    <i class="cbp_tmicon rounded-x hidden-xs"></i>
                    <div class="cbp_tmlabel">
                        <a href="<?php 
    print $item['url'];
    ?>
"><h2><?php 
    print $item['title'];
    ?>
</h2></a>
                        <div class="row">
                            <div class="col-md-4">
                                <img class="img-responsive" src="<?php 
    print thumbnail(get_picture($item['id']));
    ?>
" alt=""> 
                                <div class="md-margin-bottom-20"></div>
                            </div>
                            <div class="col-md-8">    
                                <?php 
    if (!isset($item['description']) or $item['description'] == '') {
        if (isset($item['content']) and $item['content'] != '') {
            $item['description'] = character_limiter(strip_tags($item['content']), $character_limit);
            $item['full_description'] = strip_tags($item['content']);
        } elseif (isset($item['content_body']) and $item['content_body'] != '') {
            $item['full_description'] = strip_tags($item['content']);
            $item['description'] = character_limiter(strip_tags($item['content_body']), $character_limit);
        }
    }
Example #7
0
      <div class="mw-ui-box mw-ui-box-order-info">
        <div class="mw-ui-box-header"> <span>
          <?php 
_e("Order Information");
?>
          </span> </div>
        <div class="mw-ui-box-content">
          <?php 
if (is_array($cart_items)) {
    ?>
          <div class="mw-order-images">
            <?php 
    for ($i = 0; $i < sizeof($cart_items); $i++) {
        ?>
            <?php 
        $p = get_picture($cart_items[$i]['rel_id']);
        ?>
            <?php 
        if ($p != false) {
            ?>
            <span data-index="<?php 
            print $i;
            ?>
" class="bgimage mw-order-item-image mw-order-item-image-<?php 
            print $i;
            ?>
" style="width: 70px;height:70px;background-image:url(<?php 
            print thumbnail($p, 120, 120);
            ?>
);"></span>
            <?php 
Example #8
0
    function index($params, $config)
    {
        $current_page = $current_page = 1;
        $post_params = $params;
        if (isset($post_params['id'])) {
            $paging_param = 'current_page' . crc32($post_params['id']);
            unset($post_params['id']);
        }
        $cat_from_url = url_param('category');
        $posts_parent_related = false;
        if (isset($params['current_page'])) {
            // $params['current_page'] = $params['current_page'];
        } elseif (isset($params['curent-page'])) {
            $params['current_page'] = $params['curent-page'];
        } elseif (isset($params['current-page'])) {
            $params['current_page'] = $params['current-page'];
        } elseif (isset($params['curent-page'])) {
            $params['current_page'] = $params['curent-page'];
        }
        if (isset($params['paging_param'])) {
            if (isset($params[$params['paging_param']])) {
                $current_page = $current_page = $params['current_page'] = $params[$params['paging_param']];
                $paging_param = $params['paging_param'];
            }
        }
        if (isset($params['current_page'])) {
            $current_page = $params['current_page'] = $params['current_page'];
        } else {
            $current_page_from_url = url_param($paging_param);
            if ($current_page_from_url != false) {
                $current_page = $current_page_from_url;
            }
        }
        if (isset($post_params['data-page-number'])) {
            $post_params['current_page'] = $post_params['data-page-number'];
            unset($post_params['data-page-number']);
        }
        if (isset($post_params['data-category-id'])) {
            $post_params['category'] = $post_params['data-category-id'];
            unset($post_params['data-category-id']);
        }
        if (isset($params['data-paging-param'])) {
            $paging_param = $params['data-paging-param'];
        }
        $show_fields = false;
        if (isset($post_params['data-show'])) {
            $show_fields = $post_params['data-show'];
        }
        if (isset($post_params['show'])) {
            $show_fields = $post_params['show'];
        }
        $set_content_type_from_opt = get_option('data-content-type', $params['id']);
        $show_fields1 = get_option('data-show', $params['id']);
        if ($show_fields1 != false and is_string($show_fields1) and trim($show_fields1) != '') {
            $show_fields = $show_fields1;
        }
        if ($show_fields != false and is_string($show_fields)) {
            $show_fields = explode(',', $show_fields);
        }
        if (isset($post_params['limit'])) {
            $post_params['limit'] = $post_params['limit'];
        }
        if (isset($post_params['data-limit'])) {
            $post_params['limit'] = $post_params['data-limit'];
        }
        if (!isset($post_params['data-limit'])) {
            $posts_limit = get_option('data-limit', $params['id']);
            if ($posts_limit != false) {
                $post_params['limit'] = $posts_limit;
            }
        }
        $posts_parent_category = $posts_parent_category_cfg = get_option('data-category-id', $params['id']);
        if ($posts_parent_category == '') {
            $posts_parent_category = false;
        }
        $set_category_for_posts = false;
        $posts_limit = get_option('data-limit', $params['id']);
        if ($posts_limit != false) {
            $post_params['data-limit'] = $post_params['limit'] = $posts_limit;
        }
        $cfg_page_id = $cfg_page_id_force = get_option('data-page-id', $params['id']);
        if ($cfg_page_id == false and isset($post_params['data-page-id'])) {
            $cfg_page_id = intval($post_params['data-page-id']);
        } else {
            if ($cfg_page_id == false and isset($post_params['content_id'])) {
                $cfg_page_id = intval($post_params['content_id']);
            } else {
                if ($cfg_page_id == false and isset($post_params['content-id'])) {
                    $cfg_page_id = intval($post_params['content-id']);
                } elseif ($cfg_page_id == false and isset($post_params['current_page'])) {
                    $cfg_page_id = 'current_page';
                }
            }
        }
        if ($posts_parent_category == false and isset($post_params['category_id'])) {
            $posts_parent_category = $post_params['category_id'];
        }
        if ($posts_parent_category == false and isset($post_params['related'])) {
            if (defined('CATEGORY_ID') and CATEGORY_ID > 0) {
                $posts_parent_category = $posts_parent_related = CATEGORY_ID;
            }
        }
        if ($posts_parent_category_cfg == 'related') {
            $posts_parent_related = true;
            $posts_parent_category = $posts_parent_related = CATEGORY_ID;
        }
        if ($posts_parent_category == false and $cfg_page_id == 'current_page') {
            if (defined('PAGE_ID') and PAGE_ID > 0) {
                $cfg_page_id = PAGE_ID;
            }
        }
        if ($posts_parent_category_cfg == false) {
            if (defined('CATEGORY_ID') and CATEGORY_ID > 0) {
                $posts_parent_category = CATEGORY_ID;
            }
        }
        if ($cfg_page_id == false and isset($post_params['related']) and $post_params['related'] != false and (!isset($post_params['parent']) or $post_params['parent'] == false)) {
            if (defined('PAGE_ID') and PAGE_ID > 0) {
                $cfg_page_id = PAGE_ID;
                $post_params['parent'] = $cfg_page_id;
            }
        }
        if (isset($post_params['most_ordered'])) {
            //
            $str0 = 'table=cart&limit=30&rel_type=content&fields=rel_id&order_by=id desc';
            $orders = db_get($str0);
            if (!empty($orders)) {
                $ids = array();
                foreach ($orders as $order) {
                    $ids[] = $order['rel_id'];
                }
                $post_params['ids'] = $ids;
            }
        }
        if (isset($post_params['recently_viewed'])) {
            if (defined("MAIN_PAGE_ID") and defined("CONTENT_ID")) {
                $str0 = 'table=stats_pageviews&limit=30&main_page_id=' . MAIN_PAGE_ID . '&page_id=[neq]' . CONTENT_ID . '&fields=page_id&order_by=id desc&no_cache=true';
                $orders = db_get($str0);
                if (!empty($orders)) {
                    $ids = array();
                    foreach ($orders as $order) {
                        $ids[] = $order['page_id'];
                    }
                    $post_params['ids'] = $ids;
                }
            }
        }
        if ($posts_parent_related == false) {
            if (intval($cfg_page_id_force) or !isset($params['global'])) {
                if ($cfg_page_id != false and intval($cfg_page_id) > 0) {
                    $sub_categories = array();
                    $page_categories = false;
                    if (intval($cfg_page_id) != 0 and $cat_from_url == false) {
                        $str0 = 'table=categories&limit=1000&data_type=category&what=categories&' . 'parent_id=0&rel_id=' . $cfg_page_id;
                        $page_categories = db_get($str0);
                        $str0 = 'table=categories&limit=1000&data_type=category&what=categories&' . 'parent_id=0&rel_id=' . $cfg_page_id;
                        $page_categories = db_get('table=categories&limit=1&data_type=category&' . 'parent_id=0&rel_id=' . $cfg_page_id);
                        if (is_array($page_categories)) {
                            foreach ($page_categories as $item_cat) {
                                $sub_categories[] = $item_cat['id'];
                                $more = get_category_children($item_cat['id']);
                                if ($more != false and is_array($more)) {
                                    foreach ($more as $item_more_subcat) {
                                        $sub_categories[] = $item_more_subcat;
                                    }
                                }
                            }
                        }
                    }
                    if ($posts_parent_category != false and intval($posts_parent_category) > 0 and $cat_from_url == false) {
                        if ($page_categories != false and is_array($page_categories) and !empty($page_categories)) {
                            // $sub_categories = array();
                            foreach ($page_categories as $item_cat) {
                                if (intval($item_cat['id']) == intval($posts_parent_category)) {
                                    $sub_categories[] = $item_cat['id'];
                                }
                            }
                        } elseif ($posts_parent_category_cfg != false) {
                            $post_params['category'] = $posts_parent_category_cfg;
                        }
                        if (is_array($sub_categories) and !empty($sub_categories) and isset($post_params['related']) and $post_params['related'] != false) {
                            $post_params['category'] = $sub_categories;
                        } elseif ($cfg_page_id != false) {
                            $post_params['parent'] = $cfg_page_id;
                        }
                    } else {
                        $post_params['parent'] = $cfg_page_id;
                        if (($cfg_page_id == PAGE_ID or $cfg_page_id == MAIN_PAGE_ID) and (!isset($post_params['category']) or $post_params['category'] == false) and $cat_from_url != false) {
                            $post_params['category'] = $cat_from_url;
                        }
                    }
                } elseif ($cat_from_url != false) {
                    $post_params['category'] = $cat_from_url;
                } elseif ($posts_parent_category != false and intval($posts_parent_category) > 0 and $cfg_page_id != false) {
                    $post_params['category'] = $posts_parent_category;
                }
            }
            if ($posts_parent_category_cfg != false and intval($posts_parent_category_cfg) > 0 and $cfg_page_id_force != false and intval($cfg_page_id_force) > 0) {
                $post_params['category'] = $posts_parent_category_cfg;
            }
        } else {
            $post_params['category'] = $posts_parent_related;
        }
        $tn_size = array('150');
        $tn = $tn_size;
        if (isset($post_params['data-thumbnail-size'])) {
            $temp = explode('x', strtolower($post_params['data-thumbnail-size']));
            if (!empty($temp)) {
                $tn_size = $temp;
            }
        } else {
            $cfg_page_item = get_option('data-thumbnail-size', $params['id']);
            if ($cfg_page_item != false) {
                $temp = explode('x', strtolower($cfg_page_item));
                if (!empty($temp)) {
                    $tn_size = $temp;
                }
            }
        }
        if (!isset($tn[0]) or $tn[0] == 150) {
            $tn[0] = 350;
        }
        if (!isset($tn[1])) {
            $tn[1] = $tn[0];
        }
        $character_limit = 120;
        $cfg_character_limit = get_option('data-character-limit', $params['id']);
        if ($cfg_character_limit != false and trim($cfg_character_limit) != '') {
            $character_limit = intval($cfg_character_limit);
        } else {
            if (isset($params['description-length'])) {
                $character_limit = intval($params['description-length']);
            }
        }
        $title_character_limit = 200;
        $cfg_character_limit1 = get_option('data-title-limit', $params['id']);
        if ($cfg_character_limit1 != false and trim($cfg_character_limit1) != '') {
            $title_character_limit = intval($cfg_character_limit1);
        } else {
            if (isset($params['title-length'])) {
                $title_character_limit = intval($params['title-length']);
            }
        }
        if ($show_fields == false) {
            //$show_fields = array('thumbnail', 'title', 'description', 'read_more');
        }
        if (is_array($show_fields)) {
            $show_fields = array_trim($show_fields);
        }
        if (isset($current_page) and intval($current_page) > 0) {
            $post_params['current_page'] = intval($current_page);
        }
        if (!isset($post_params['global'])) {
            if (!isset($post_params['content_type'])) {
                $post_params['content_type'] = 'post';
            }
        }
        if (isset($params['is_shop'])) {
            $post_params['content_type'] = 'product';
            unset($post_params['is_shop']);
        }
        if (!isset($post_params['content_type']) and !isset($post_params['global'])) {
            $post_params['content_type'] = 'post';
        }
        if (!isset($params['order_by']) and isset($params['order-by'])) {
            $params['orderby'] = $post_params['orderby'] = $params['order-by'];
        }
        if (isset($params['subtype_value'])) {
            $post_params['subtype_value'] = $params['subtype_value'];
        }
        $schema_org_item_type = false;
        $schema_org_item_type_tag = false;
        if (isset($post_params['content_type']) and $post_params['content_type'] == 'page') {
            $schema_org_item_type = 'WebPage';
        } else {
            if (isset($post_params['content_type']) and $post_params['content_type'] == 'post') {
                if (isset($post_params['subtype']) and $post_params['subtype'] != $post_params['content_type']) {
                    $schema_org_item_type = $post_params['subtype'];
                } else {
                    $schema_org_item_type = 'Article';
                }
            }
        }
        if ($schema_org_item_type != false) {
            $schema_org_item_type = ucfirst($schema_org_item_type);
            $schema_org_item_type_tag = ' itemtype="http://schema.org/' . $schema_org_item_type . '" ';
            $schema_org_item_type_tag = 'http://schema.org/' . $schema_org_item_type;
        }
        $ord_by = get_option('data-order-by', $params['id']);
        if ($ord_by != false and trim($ord_by) != '') {
            $post_params['orderby'] = $ord_by;
        }
        $date_format = get_option('date_format', 'website');
        if ($date_format == false) {
            $date_format = "Y-m-d H:i:s";
        }
        if (isset($params['title'])) {
            unset($post_params['title']);
        }
        $post_params['is_active'] = 1;
        $post_params['is_deleted'] = 0;
        if ((!isset($post_params['parent']) and !isset($post_params['category']) or isset($post_params['category']) and empty($post_params['category'])) and $cat_from_url != false and trim($cat_from_url) != '') {
            $post_params['category'] = $cat_from_url;
        }
        if (isset($params['content_type']) and $params['content_type'] == 'all') {
            unset($post_params['content_type']);
            unset($post_params['subtype']);
        }
        if (isset($params['search-parent'])) {
            $sub_content = get_content_children($params['search-parent']);
            if (!empty($sub_content)) {
                $post_params['ids'] = $sub_content;
                unset($post_params['parent']);
            }
        }
        if (isset($params['data-id'])) {
            unset($post_params['data-id']);
        }
        if ($posts_parent_related == false) {
            if (isset($post_params['category']) and is_string($post_params['category'])) {
                $sub_categories = array();
                $sub_categories[] = $post_params['category'];
                $more = get_category_children($post_params['category']);
                if ($more != false and is_array($more)) {
                    foreach ($more as $item_more_subcat) {
                        $sub_categories[] = $item_more_subcat;
                    }
                }
                //$post_params['category']
                $post_params['category'] = $sub_categories;
                //$post_params['category'] = $post_params['category'];
            } else {
                if (isset($post_params['category']) and is_array($post_params['category']) and empty($post_params['category']) and isset($post_params['related']) and $post_params['related'] != false) {
                    if (defined('CATEGORY_ID') and CATEGORY_ID > 0) {
                        $post_params['category'] = CATEGORY_ID;
                    }
                }
            }
        }
        if (defined('POST_ID') and isset($posts_parent_category) and $posts_parent_category != false or isset($post_params['related'])) {
            $post_params['exclude_ids'] = POST_ID;
        }
        if (!isset($params['order_by'])) {
            //            if(isset($post_params['content_type']) and $post_params['content_type'] == 'page'){
            //                $post_params['order_by'] = 'position asc';
            //            } else {
            //
            //            }
            $post_params['order_by'] = 'position desc';
        }
        if (isset($params['search_in_fields']) and $params['search_in_fields'] != false) {
            $post_params['search_in_fields'] = $params['search_in_fields'];
        }
        $content = get_content($post_params);
        if ($posts_parent_related != false and empty($content) and isset($post_params['category'])) {
            unset($post_params['category']);
            $content = get_content($post_params);
        }
        $data = array();
        if (!empty($content)) {
            foreach ($content as $item) {
                $iu = get_picture($item['id'], $for = 'post', $full = false);
                if ($iu != false) {
                    $item['image'] = $iu;
                } else {
                    $item['image'] = false;
                }
                if ($item['image'] != false) {
                    $item['tn_image'] = thumbnail($item['image'], $tn[0], $tn[1]);
                } else {
                    $item['tn_image'] = false;
                }
                $item['content'] = htmlspecialchars_decode($item['content']);
                if (isset($item['created_at']) and trim($item['created_at']) != '') {
                    $item['created_at'] = date($date_format, strtotime($item['created_at']));
                }
                if (isset($item['updated_at']) and trim($item['updated_at']) != '') {
                    $item['updated_at'] = date($date_format, strtotime($item['updated_at']));
                }
                $item['link'] = content_link($item['id']);
                $item['full_description'] = '';
                if (!isset($item['description']) or $item['description'] == '') {
                    if (isset($item['content']) and $item['content'] != '') {
                        $item['description'] = character_limiter(strip_tags($item['content']), $character_limit);
                        $item['full_description'] = strip_tags($item['content']);
                    } elseif (isset($item['content_body']) and $item['content_body'] != '') {
                        $item['full_description'] = strip_tags($item['content']);
                        $item['description'] = character_limiter(strip_tags($item['content_body']), $character_limit);
                    }
                } else {
                    $item['full_description'] = trim($item['description']);
                    $item['description'] = character_limiter(strip_tags($item['description']), $character_limit);
                }
                if (isset($item['title']) and $item['title'] != '') {
                    $item['full_title'] = $item['title'];
                    $item['title'] = character_limiter($item['title'], $title_character_limit);
                }
                if (isset($post_params['content_type']) and $post_params['content_type'] == 'product') {
                    $item['prices'] = get_custom_fields("field_type=price&for=content&for_id=" . $item['id']);
                } else {
                    $item['prices'] = false;
                }
                if (isset($item['prices']) and is_array($item['prices']) and !empty($item['prices'])) {
                    $vals2 = array_values($item['prices']);
                    $val1 = array_shift($vals2);
                    $item['price'] = $val1;
                } else {
                    $item['price'] = false;
                }
                if (isset($show_fields) and is_array($show_fields) and !empty($show_fields)) {
                    if (!in_array('title', $show_fields)) {
                        $item['title'] = false;
                    }
                    if (!in_array('description', $show_fields)) {
                        $item['description'] = false;
                    }
                    if (!in_array('created_at', $show_fields)) {
                        $item['created_at'] = false;
                    }
                    if (!in_array('read_more', $show_fields)) {
                        $item['read_more'] = false;
                    }
                    if (!in_array('thumbnail', $show_fields)) {
                        $item['thumbnail'] = false;
                    }
                }
                $data[] = $item;
            }
        } else {
            if (isset($params['is_shop'])) {
                print lnotif('Your products module is empty');
            } elseif (isset($params['global'])) {
                print lnotif('Your content module is empty');
            } else {
                print lnotif('Your posts module is empty');
            }
        }
        $post_params_paging = $post_params;
        $post_params_paging['page_count'] = true;
        $cfg_data_hide_paging = get_option('data-hide-paging', $params['id']);
        if ($cfg_data_hide_paging === false) {
            if (isset($post_params['hide_paging']) and trim($post_params['hide_paging']) != 'false') {
                $post_params['hide-paging'] = $post_params['hide_paging'];
                unset($post_params['hide_paging']);
            }
            if (isset($post_params['hide-paging']) and trim($post_params['hide-paging']) != 'false') {
                $cfg_data_hide_paging = 'y';
                unset($post_params['hide-paging']);
            }
        }
        if ($cfg_data_hide_paging != 'y') {
            $pages_of_posts = get_content($post_params_paging);
            $pages_count = intval($pages_of_posts);
        } else {
            $pages_count = 0;
        }
        $paging_links = false;
        if (intval($pages_count) > 1) {
            //$paging_links = mw()->content_manager->paging_links(false, $pages_count, $paging_param, $keyword_param = 'keyword');
        }
        $read_more_text = get_option('data-read-more-text', $params['id']);
        $add_cart_text = get_option('data-add-to-cart-text', $params['id']);
        if ($add_cart_text == false or $add_cart_text == "Add to cart") {
            $add_cart_text = _e("Add to cart", true);
        }
        if (!isset($params['return'])) {
            $module_template = get_option('data-template', $params['id']);
            if ($module_template == false and isset($params['template'])) {
                $module_template = $params['template'];
            }
            if ($module_template != false) {
                if (strtolower($module_template) == 'none') {
                    if (isset($params['template'])) {
                        $module_template = $params['template'];
                    }
                }
                $template_file = module_templates($config['module'], $module_template);
            } else {
                $template_file = module_templates($config['module'], 'default');
            }
            if ($template_file == false) {
                $template_file = module_templates($config['module'], 'default');
            }
            if (isset($template_file) and is_file($template_file) != false) {
                include $template_file;
                ?>
                <?php 
                if (isset($params['ajax_paging']) or isset($params['ajax-paging'])) {
                    ?>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            mw.$('#<?php 
                    print $params['id'];
                    ?>
').find('a[data-page-number]').unbind('click');
                            mw.$('#<?php 
                    print $params['id'];
                    ?>
').find('a[data-page-number]').click(function (e) {
                                var pn = $(this).attr('data-page-number');
                                mw.$('#<?php 
                    print $params['id'];
                    ?>
').attr('paging_param', 'current_page');
                                mw.$('#<?php 
                    print $params['id'];
                    ?>
').attr('current_page', pn)
                                mw.reload_module('#<?php 
                    print $params['id'];
                    ?>
');
                                return false;
                            });
                        });
                    </script>
                <?php 
                }
                ?>
                <?php 
                if (isset($params['is_shop'])) {
                    ?>
                    <script type="text/javascript">
                        mw.require("shop.js");
                    </script>
                <?php 
                }
                ?>
            <?php 
            } else {
                print lnotif('No default template for ' . $config['module'] . ' is found');
            }
        }
    }
Example #9
0
?>
            <?php 
$count = 0;
foreach ($posts as $item) {
    $count++;
    if ($count % 2 == 0) {
        print '<li class="timeline-inverted">';
    } else {
        print "<li>";
    }
    ?>
        
            <div class="timeline-panel">
                <div class="timeline-heading">
                    <img class="img-responsive" src="<?php 
    print get_picture($item['id']);
    ?>
" alt=""/>
                </div>

                <div class="timeline-body text-justify">
                    <h2><a href="<?php 
    print $item['url'];
    ?>
"><?php 
    print $item['title'];
    ?>
</a></h2>
                    <?php 
    if (!isset($item['description']) or $item['description'] == '') {
        if (isset($item['content']) and $item['content'] != '') {
Example #10
0
 function createthumb()
 {
     if (IS_POST) {
         $info = array('status' => 2, 'info' => '', 'url' => '');
         $arccatid = I('post.article_catid');
         $catid = I('post.category_d');
         //查询是否有没有处理完的图片
         $thumbpath = F('thumbpath');
         if (empty($thumbpath)) {
             //开始查询要处理的图片数据
             $temarr = array();
             $map['pic'] = array('neq', 0);
             if ($arccatid != 0) {
                 $map['category_id'] = $arccatid;
             }
             $list = M('Article')->where($map)->field('pic')->select();
             foreach ($list as $val) {
                 $temarr[] = $val['pic'];
             }
             if ($catid != 0) {
                 $map['category_id'] = $catid;
             }
             $list = M('goods')->where($map)->field('pic,xc')->select();
             foreach ($list as $val) {
                 $temarr[] = $val['pic'];
                 //拆分相册
                 $xcarr = explode('|', $val['xc']);
                 foreach ($xcarr as $val) {
                     $temarr[] = $val;
                 }
             }
             //把查到的数量保存到缓存中
             F('thumbpath', $temarr);
             $thumbpath = $temarr;
         }
         //开始生成图片
         $jishu = 0;
         //处理的总数量
         $sucstr = '';
         //成功字符串
         $failjishu = 0;
         //失败的数量
         $failstr = '';
         //错误字符串
         $num = count($thumbpath);
         $num = $num > 50 ? 50 : $num;
         //一次只处理50个数据
         $i = 0;
         for ($i; $i < $num; $i++) {
             if (count($thumbpath) > 0) {
                 $spath = get_picture($thumbpath[$i], 'path');
                 $thupath = str_replace('image/', 'image/thumb/', $spath);
                 $spath = path_a($spath);
                 $dpath = str_replace('image/', 'image/thumb/', $spath);
                 if (file_exists($spath)) {
                     //源文件存在
                     if (file_exists($dpath)) {
                         unlink($dpath);
                     }
                     $result = create_thumb($spath, $dpath, C('THUMB_WIDTH'), C('THUMB_HEIGHT'));
                     if ($result === true) {
                         M('Picture')->where("id={$thumbpath[$i]}")->save(array('thumbpath' => $thupath));
                         $jishu++;
                         $sucstr .= $spath . '->' . $dpath . '<br>';
                     } else {
                         $failjishu++;
                         $failstr .= $spath . '->' . $dpath . '<br>';
                     }
                 } else {
                     $failjishu++;
                     $failstr .= '<span style="color:red;">' . $spath . "此路径文件丢失数据库id为{$thumbpath[$i]}请联系管理员自行处理</span><br>";
                 }
                 unset($thumbpath[$i]);
             }
         }
         $tishistr = '全部完成';
         if (count($thumbpath) <= 0) {
             $info['status'] = 1;
         } else {
             $tishistr = '还剩' . count($thumbpath) . '个。继续生成中......';
         }
         F('thumbpath', array_values($thumbpath));
         $info['info'] = "成功生成{$jishu}个缩略图,失败{$failjishu}个,{$failstr},{$tishistr}";
         $this->ajaxreturn($info);
         exit;
     } else {
         //文章分类树
         $catelist = F('sys_category_tree');
         if (empty($catelist)) {
             $catelist = F_get_cate_list(true, 'article');
             F('sys_category_tree', $catelist);
         }
         $catelist[0] = '全部分类';
         $field = array(array('field' => 'arccat_catid', 'name' => 'arccat_catid', 'type' => 'select', 'title' => '文章分类', 'note' => '', 'extra' => $catelist, 'is_show' => 3));
         $this->assign('fieldarr1', $field);
         $this->display();
     }
 }
    $childs = mysql_query($query);
    $count = 0;
    while ($child = mysql_fetch_assoc($childs)) {
        ?>
                                <center>
                                    <?php 
        if ($count % 3 == 2) {
            ?>
                                        <div class="row">
                                            <?php 
        }
        ?>

                                        <div class="col-xs-4">
                                            <?php 
        $picture_name = get_picture($child['ID']);
        if ($picture_name) {
            ?>
                                                <img src="../../picture/<?php 
            echo $picture_name;
            ?>
" class="img-rounded" alt="Responsive image" width=100px height=100px > 
                                                <?php 
        } else {
            if ($child['GENDER_ID'] == 0) {
                ?>
                                                    <img src="../../picture/Non.jpg" class="img-rounded" alt="Responsive image" width=100px height=100px > 
                                                    <?php 
            }
            if ($child['GENDER_ID'] == 1) {
                ?>
Example #12
0
                                        <?php 
}
?>
                                        <?php 
if ($next != false) {
    ?>
                                            <a href="<?php 
    print $next['url'];
    ?>
"
                                               class="mw-icon-arrow-right-slim next-content tip"
                                               data-tip="#next-tip"></a>
                                            <div id="next-tip" style="display: none">
                                                <div class="next-previous-tip-content">
                                                    <img src="<?php 
    print get_picture($next['id']);
    ?>
" alt="" width="90"/>
                                                    <h6><?php 
    print $next['title'];
    ?>
</h6>
                                                </div>
                                            </div>
                                        <?php 
}
?>
                                    </div>
                                </div>
                            </div>
                            <h2 class="edit post-title" field="title" rel="post" style="padding: 20px 0 10px;">Product inner page</h2>
Example #13
0
                                  </div>
                              </div>
                          <?php 
}
?>
                          <?php 
if ($prev != false) {
    ?>
                              <a href="<?php 
    print $prev['url'];
    ?>
" class="mw-icon-arrow-right-slim prev-content tip" data-tip="#prev-tip"></a>
                              <div id="prev-tip" style="display: none">
                                  <div class="next-previous-tip-content">
                                      <img src="<?php 
    print get_picture($prev['id']);
    ?>
" alt="" width="90" />
                                      <h6><?php 
    print $prev['title'];
    ?>
</h6>
                                  </div>
                              </div>
                          <?php 
}
?>

                          </div>
                      </div>
                  </div>
Example #14
0
?>
 
<?php 
if ($categories) {
    ?>
<div class="categories-grid">
  <?php 
    foreach ($categories as $category) {
        ?>
  <a href="<?php 
        print category_link($category['id']);
        ?>
" class="category-grid-item">
    <span class="category-grid-item-content">
      <?php 
        $cat_image = get_picture($category['id'], 'categories');
        ?>
      <span class="category-image" style="background-image: url('<?php 
        if ($cat_image) {
            print $cat_image;
        }
        ?>
');"></span> <strong><?php 
        print $category['title'];
        ?>
</strong>
    </span>
  </a>
  <?php 
    }
    ?>
Example #15
0
?>
" >
                        </div>
                        <div class="col-xs-2 " style="margin-top:0" id="notPrint">
                            <a class="btn btn-material-teal" role="button" style="margin-top: 0px" onclick="javascript:window.open('../../print/edit.php?id=<?php 
echo $id;
?>
', '', 'nenuber=no,toorlbar=no,location=no,scrollbars=no, status=no,resizable=no,width=800,height=650,top=0,left=150 ')"><i class="mdi-action-print"></i>พิมพ์</a>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-xs-2">
                            <img id="output"
                            <?php 
$picture_name = get_picture($id);
if ($picture_name) {
    echo 'src="../../picture/' . $picture_name . '"';
} else {
    echo 'src="../../picture/non.jpg"';
}
?>
                                 class="img-rounded" alt="Responsive image" width=100px height=100px >
                        </div>
                        <div class="col-xs-6" style="margin-top:0">
                            <input type="file" name="picture" id="picture" data-input="false"  class="filestyle" data-buttonText="เปลี่ยนรูปประจำตัว" accept="image/*" value="fasfs" onchange="ValidateSingleInput(this);">
                        </div>
                        <div class="col-xs-2" style="margin-top:10">
                            ผู้ติดตามจำนวน
                        </div>
                        <div class="col-xs-1" style="margin-top:10">
Example #16
0
                                          <th>Title</th>
                                          <th>Quantity</th>
                                          <th>Price</th>
                                          <th>Total</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                           <?php 
            foreach ($cart as $product) {
                ?>
                                           <?php 
                $theproduct = get_content_by_id($product['rel_id']);
                ?>
                                             <tr>
                                                <td><img src="<?php 
                print get_picture($theproduct['id']);
                ?>
" width="70" alt="" /> </td>
                                                <td><?php 
                print $theproduct['title'];
                ?>
</td>
                                                <td><?php 
                print $product['qty'];
                ?>
</td>
                                                <td><?php 
                print $product['price'];
                ?>
</td>
                                                <td><?php 
        if (!isset($json->{'ShopId'})) {
            echo_invalid_param($json);
        }
        get_shop_info($json);
        break;
    case OPCODE::SERVICE_GET_SHOP_INFO_REQUEST_BY_BSSID:
        if (!isset($json->{'BSSID'})) {
            echo_invalid_param($json);
        }
        get_shop_info_by_bssid($json);
        break;
    case OPCODE::SERVICE_GET_PICTURE_REQUEST:
        if (!isset($json->{'ShopId'})) {
            echo_invalid_param($json);
        }
        get_picture($json);
        break;
    case OPCODE::SERVICE_GET_PROMOTION_REQUEST:
        if (!isset($json->{'ShopId'})) {
            echo_invalid_param($json);
        }
        get_promotion($json);
        break;
}
function get_requested_co_promotion($json)
{
    $database = new Database();
    $coProTbl = $database->getCoPromotionTbl();
    $promotionTbl = $database->getPromotionTbl();
    $copros = $coProTbl->getAllRequested($json->{'ShopId'});
    $ret_array = array();
Example #18
0
        ?>
      <tr class="mw-cart-item mw-cart-item-<?php 
        print $item['id'];
        ?>
">
        <td><?php 
        if (isset($item['item_image']) and $item['item_image'] != false) {
            ?>
          <?php 
            $p = $item['item_image'];
            ?>
          <?php 
        } else {
            ?>
          <?php 
            $p = get_picture($item['rel_id']);
            ?>
          <?php 
        }
        ?>
          <?php 
        if ($p != false) {
            ?>
          <img height="70" class="img-polaroid img-rounded mw-order-item-image mw-order-item-image-<?php 
            print $item['id'];
            ?>
" src="<?php 
            print thumbnail($p, 70, 70);
            ?>
"  />
          <?php 
Example #19
0
<?php

//session_start();
require 'functions.php';
$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
if (($_FILES["file"]["type"] == "image/pjpeg" || $_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg") && $_FILES["file"]["size"] < 800000 && in_array($extension, $allowedExts)) {
    if ($_FILES["file"]["error"] > 0) {
        echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    } else {
        // $conn=connect();
        // $query="select max(id) as max from news";
        // $res=mysqli_query($conn,$query);
        // $row=mysqli_fetch_assoc($res);
        // $id=$row['max']+1;
        $path = "../temp/" . $_FILES["file"]["name"];
        if (file_exists($path)) {
            echo $path . " already exists. ";
        } else {
            delete_uploaded_image();
            move_uploaded_file($_FILES["file"]["tmp_name"], $path);
            echo get_picture();
        }
    }
} else {
    echo "Invalid file";
}
Example #20
0
                    <div class="mw-ui-col manage-post-item-col-1">
                        <label class="mw-ui-check">
                            <input name="select_posts_for_action" class="select_posts_for_action" type="checkbox"
                                   value="<?php 
            print $item['id'];
            ?>
" onclick="mw.admin.showLinkNav();">
                            <span></span> </label>
        <span class="mw-icon-drag mw_admin_posts_sortable_handle"
              onmousedown="mw.manage_content_sort()"></span></div>
                    <div class="mw-ui-col manage-post-item-col-2">
                    


                        <?php 
            $pic = get_picture($item['id']);
            ?>
                        <?php 
            if ($pic == true) {
                ?>
                            <a class="manage-post-image"
                               style="background-image: url('<?php 
                print thumbnail($pic, 108);
                ?>
');"
                               onClick="mw.url.windowHashParam('action','editpage:<?php 
                print $item['id'];
                ?>
');return false;"></a>
                        <?php 
            } else {
Example #21
0
            preg_match($pattern, $images[$k], $matches);
            $ext = $matches[0];
            if ($images[$k] == $main_img) {
                $path = "../my_images/news" . $insert_id . '-main.' . $ext;
            } else {
                $path = "../my_images/news" . $insert_id . '_' . $index . '.' . $ext;
                $index++;
            }
            if (!is_file($path)) {
                copy('../temp/' . $images[$k], $path);
            }
        }
        delete_uploaded_images();
    }
} elseif ($type == 'update') {
    $id = $_POST['id'];
    $query = "UPDATE news SET content='" . $content . "',title='" . $title . "',video='" . $video . "',heading='" . $heading . "',lang='" . $language . "' WHERE id='" . $id . "'";
    mysqli_query($conn, $query);
    $image = get_picture();
    if ($image) {
        $pattern = '~(jpg|jpeg|gif|png)~';
        preg_match($pattern, $image, $matches);
        $ext = $matches[0];
        $path = "../my_images/news" . $id . '.' . $ext;
        if (!is_file($path)) {
            unlink($path);
        }
        copy('../temp/' . $image, $path);
        delete_uploaded_image();
    }
}
Example #22
0
<?php

only_admin_access();
$data = array('content_id' => $params['content_id']);
$comments = get_comments($data);
$item = get_content_by_id($params['content_id']);
$content_id = $params['content_id'];
$moderation_is_required = get_option('require_moderation', 'comments') == 'y';
?>

<div class="comment-post">
  <div class="comment-info-holder" content-id="<?php 
print $item['id'];
?>
" onclick="mw.adminComments.toggleMaster(this, event)"> <span class="img"> <img src="<?php 
print thumbnail(get_picture($content_id), 67, 67);
?>
" alt="" />
    <?php 
// $new = get_comments('count=1&is_moderated=n&rel=content&rel_id='.$content_id);
$new = get_comments('count=1&is_new=y&rel=content&rel_id=' . $content_id);
?>
    <?php 
if ($new > 0) {
    ?>
    <span class="comments_number"><?php 
    print $new;
    ?>
</span>
    <?php 
}
Example #23
0
<?php

error_reporting(E_ERROR | E_PARSE);
include '../../helper/db_connect.php';
connect_database();
$time = date('Y-m-d H:i:s', time());
$data_id = $_GET["id"];
if (isset($_FILES["picture"])) {
    $time = date('Y-m-d H:i:s', time());
    $target_dir = "../../picture/";
    $target_file = $target_dir . basename($_FILES["picture"]["name"]);
    $newfilename = basename($_FILES["picture"]["name"]);
    $picture_name = get_picture($data_id);
    echo '1';
    if (file_exists($target_file)) {
        $temp = explode(".", $_FILES["picture"]["name"]);
        $last = mysql_query("SELECT `ID` FROM `picture` ORDER BY ID DESC LIMIT 1");
        $last_id = mysql_fetch_assoc($last);
        print_r($temp);
        $newfilename = $temp[0] . "_" . ($last_id['ID'] + 1) . '.' . end($temp);
        $target_file = $target_dir . $newfilename;
        echo $target_file;
    }
    echo $target_dir;
    if ($picture_name) {
        echo $query = "UPDATE `picture` SET `PICTURE_THRU_DATE`='{$time}' WHERE `PICTURE_OWNER_ID`={$data_id} AND `PICTURE_THRU_DATE`=''";
        mysql_query($query);
        if (move_uploaded_file($_FILES["picture"]["tmp_name"], $target_file)) {
            echo $sql = "INSERT INTO `picture`( `PICTURE_OWNER_ID`, `PICTURE_NAME`, `PICTURE_FROM_DATE`) VALUES ('{$data_id}','" . $newfilename . "','{$time}')";
            mysql_query($sql);
        } else {