Esempio n. 1
0
function configure_backend($option)
{
    global $my, $booklibrary_configuration, $acl;
    global $mosConfig_absolute_path;
    $yesno[] = mosHTML::makeOption('1', _BOOKLIBRARY_YES);
    $yesno[] = mosHTML::makeOption('0', _BOOKLIBRARY_NO);
    $gtree[] = mosHTML::makeOption('-2', 'Everyone');
    $gtree = get_group_children_tree_bl();
    $lists = array();
    $f = array();
    $s = explode(',', $booklibrary_configuration['review_added_email']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['review_added_email']['registrationlevel'] = mosHTML::selectList($gtree, 'review_added_email_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    $lists['review_added_email']['show'] = mosHTML::RadioList($yesno, 'review_added_email_show', 'class="inputbox"', $booklibrary_configuration['review_added_email']['show'], 'value', 'text');
    $f = array();
    $s = explode(',', $booklibrary_configuration['suggest_added_email']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['suggest_added_email']['show'] = mosHTML::RadioList($yesno, 'suggest_added_email_show', 'class="inputbox"', $booklibrary_configuration['suggest_added_email']['show'], 'value', 'text', $booklibrary_configuration['suggest_added_email']['show']);
    $lists['suggest_added_email']['registrationlevel'] = mosHTML::selectList($gtree, 'suggest_added_email_registrationlevel[] ', 'size="4" multiple="multiple"', 'value', 'text', $f);
    $f = array();
    $s = explode(',', $booklibrary_configuration['lendrequest_email']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['lendrequest_email']['show'] = mosHTML::RadioList($yesno, 'lendrequest_email_show', 'class="inputbox"', $booklibrary_configuration['lendrequest_email']['show'], 'value', 'text');
    $lists['lendrequest_email']['registrationlevel'] = mosHTML::selectList($gtree, 'lendrequest_email_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    $f = array();
    $s = explode(',', $booklibrary_configuration['addbook_email']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['addbook_email']['show'] = mosHTML::RadioList($yesno, 'addbook_email_show', 'class="inputbox"', $booklibrary_configuration['addbook_email']['show'], 'value', 'text');
    $lists['addbook_email']['registrationlevel'] = mosHTML::selectList($gtree, 'addbook_email_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    $lists['review_email']['address'] = '<input type="text" name="review_email_address" value="' . $booklibrary_configuration['review_email']['address'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    //back--1
    $lists['suggest_email']['address'] = '<input type="text" name="suggest_email_address" value="' . $booklibrary_configuration['suggest_email']['address'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['lendrequest_email']['address'] = '<input type="text" name="lendrequest_email_address" value="' . $booklibrary_configuration['lendrequest_email']['address'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['addbook_email']['address'] = '<input type="text" name="addbook_email_address" value="' . $booklibrary_configuration['addbook_email']['address'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['bookid']['auto-increment']['boolean'] = mosHTML::RadioList($yesno, 'bookid_auto_increment_boolean', 'class="inputbox"', $booklibrary_configuration['bookid']['auto-increment']['boolean'], 'value', 'text');
    //********   begin add merge description   ************************/
    $f = array();
    $s = explode(',', $booklibrary_configuration['merge_description']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['merge_description']['use'] = mosHTML::RadioList($yesno, 'merge_description_use', 'class="inputbox"', $booklibrary_configuration['merge_description']['use'], 'value', 'text');
    $lists['merge_description']['registrationlevel'] = mosHTML::selectList($gtree, 'merge_description_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    //********   end add merge description  **********************/
    $lists['fetchImages']['boolean'] = mosHTML::RadioList($yesno, 'fetchImages_boolean', 'class="inputbox"', $booklibrary_configuration['fetchImages']['boolean'], 'value', 'text');
    $lists['fetchImages']['location'] = '<input disabled="disabled" type="text" name="fetchImages_location" value="' . $booklibrary_configuration['fetchImages']['location'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['ebooks']['allow'] = mosHTML::RadioList($yesno, 'ebooks_allow', 'class="inputbox"', $booklibrary_configuration['ebooks']['allow'], 'value', 'text');
    $lists['ebooks']['location'] = '<input disabled="disabled" type="text" name="ebooks_location" value="' . $booklibrary_configuration['ebooks']['location'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['ws']['amazon']['tag'] = '<input type="text" name="ws_amazon_tag" value="' . $booklibrary_configuration['ws']['amazon']['tag'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['ws']['amazon']['devtag'] = '<input type="text" name="ws_amazon_devtag" value="' . $booklibrary_configuration['ws']['amazon']['devtag'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['ws']['amazon']['secret_key'] = '<input type="text" name="ws_amazon_secret_key" value="' . $booklibrary_configuration['ws']['amazon']['secret_key'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    @($lists['editbook']['check']['isbn'] = mosHTML::RadioList($yesno, 'editbook_check_isbn', 'class="inputbox"', $booklibrary_configuration['editbook']['check']['isbn'], 'value', 'text'));
    //back--7
    /////////////////////////////////ANTON CODE////////////////////////////////////
    /////////////Proxy Relase
    $lists['proxy_server']['address'] = '<input type="text" name="proxy_server_adress" value="' . $booklibrary_configuration['proxy_server']['address'] . '"class="inputbox" size="50" maxlength="50" title="" />';
    $lists['port_proxy_server']['address'] = '<input type="text" name="port_proxy_server_adress" value="' . $booklibrary_configuration['port_proxy_server']['address'] . '"class="inputbox" size="50" maxlength="50" title="" />';
    $lists['login_proxy_server']['address'] = '<input type="text" name="login_proxy_server_adress" value="' . $booklibrary_configuration['login_proxy_server']['address'] . '"class="inputbox" size="50" maxlength="50" title="" />';
    $lists['password_proxy_server']['address'] = '<input type="text" name="password_proxy_server_adress" value="' . $booklibrary_configuration['password_proxy_server']['address'] . '"class="inputbox" size="50" maxlength="50" title="" />';
    /////////////////////////////////ANTON CODE////////////////////////////////////
    $lists['yaz']['connection_string'] = '<input class="inputbox" type="file" name="yaz_connection_file" value="" size="50" maxlength="250" />';
    $lists['update'] = mosHTML::RadioList($yesno, 'update', 'class="inputbox"', $booklibrary_configuration['update'], 'value', 'text');
    //get language List
    $retVal1 = mosBooklibraryOthers::getLanguageArray();
    $lang = null;
    for ($i = 0, $n = count($retVal1); $i < $n; $i++) {
        $help = $retVal1[$i];
        $lang[] = mosHTML::makeOption($help[0], $help[1]);
    }
    $lists['editbook']['default']['lang'] = mosHTML::selectList($lang, 'editbook_default_lang', 'class="inputbox" size="1"', 'value', 'text', $booklibrary_configuration['editbook']['default']['lang']);
    //get host List
    $retVal = mosBooklibraryWS::getArray();
    $ws = null;
    for ($i = 0, $n = count($retVal); $i < $n; $i++) {
        $help = $retVal[$i];
        $ws[] = mosHTML::makeOption($help[0], $help[1]);
    }
    $lists['editbook']['default']['host'] = mosHTML::selectList($ws, 'editbook_default_host', 'class="inputbox" size="1"', 'value', 'text', intval($booklibrary_configuration['editbook']['default']['host']));
    $lists['lend_answer'] = mosHTML::RadioList($yesno, 'lend_answer', 'class="inputbox"', $booklibrary_configuration['lend_answer'], 'value', 'text');
    $lists['lend_form'] = $booklibrary_configuration['lend_form'];
    $lists['ebooks']['registrationlevel'] = mosHTML::selectList($gtree, 'ebooks_registrationlevel', 'size="4"', 'value', 'text', $my->id);
    //(rus)--i tam i tam nado navernoe!
    $lists['lend_before_end_notify'] = mosHTML::RadioList($yesno, 'lend_before_end_notify', 'class="inputbox"', $booklibrary_configuration['lend_before_end_notify'], 'value', 'text');
    $lists['lend_before_end_notify_days'] = '<input type="text" name="lend_before_end_notify_days" value="' . $booklibrary_configuration['lend_before_end_notify_days'] . '" class="inputbox" size="2" maxlength="2" title="" />';
    $lists['lend_before_end_notify_email'] = '<input type="text" name="lend_before_end_notify_email" value="' . $booklibrary_configuration['lend_before_end_notify_email'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    HTML_booklibrary::showConfiguration_backend($lists, $option);
}
Esempio n. 2
0
 static function showItemBL($id, $catid, $printItem)
 {
     global $mainframe, $database, $my, $acl, $option;
     global $mosConfig_shownoauth, $mosConfig_live_site, $mosConfig_absolute_path;
     global $cur_template, $Itemid, $booklibrary_configuration;
     //print_r($printItem);exit;
     //for 1.6
     $mosConfig_live_site = JURI::root(true);
     $doc = JFactory::getDocument();
     $doc->addStyleSheet($mosConfig_live_site . '/components/com_booklibrary/includes/custom.css');
     $path_way = $mainframe->getPathway();
     // variant 2
     // --
     PHP_booklibrary::addTitleAndMetaTags();
     if (!empty($catid)) {
         $query = "SELECT * FROM #__booklibrary_main_categories WHERE id='{$catid}'";
         $database->setQuery($query);
         $category = $database->loadObjectList();
         $category = $category[0];
         PHP_booklibrary::constructPathway($category);
         $path_way->addItem($category->title, sefRelToAbs('index.php?option=' . $option . '&task=showCategory&catid=' . $catid . '&Itemid=' . $Itemid));
         // for 1.6
     }
     //Record the hit
     $sql2 = "UPDATE #__booklibrary SET featured_clicks = featured_clicks - 1 WHERE featured_clicks > 0 and id = " . $id . "";
     $database->setQuery($sql2);
     $database->query();
     $sql = "UPDATE #__booklibrary SET hits = hits + 1 WHERE id = " . $id . "";
     $database->setQuery($sql);
     $database->query();
     $sql3 = "UPDATE #__booklibrary SET featured_shows = featured_shows - 1 WHERE featured_shows > 0";
     $database->setQuery($sql3);
     $database->query();
     //load the book
     $book = new mosBookLibrary($database);
     $book->load($id);
     //check access to book
     $access = $book->getAccessBook();
     //print_r($access);exit;
     if (!isset($my->id)) {
         //for 1.6
         $my->id = 0;
     }
     $query = "SELECT * FROM #__booklibrary_main_categories WHERE id='{$catid}'";
     $database->setQuery($query);
     $category = $database->loadObjectList();
     if (isset($category[0])) {
         $category = $category[0];
     } else {
         echo _BOOKLIBRARY_ERROR_ACCESS_PAGE;
         return;
     }
     $path_way->addItem($book->title, '  ');
     // for 1.6
     //end check access to book
     $session = JFactory::getSession();
     $session->get("obj_book", $book);
     // Parameters
     //      $menu = new mosMenu( $database );
     //      //$menu = new JTableMenu( $database ); // for 1.6
     //
     //      $menu->load( $Itemid );
     //      $params = new mosParameters( $menu->params );
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $menu = new JTableMenu($database);
         $menu->load($Itemid);
         $params = new JRegistry();
         $params->loadString($menu->params);
     } else {
         $menu = new mosMenu($database);
         $menu->load($GLOBALS['Itemid']);
         $params = new mosParameters($menu->params);
     }
     $menu_name = set_header_name_bl($menu, $Itemid);
     $params->def('header', $menu_name);
     //for 1.6
     $params->def('pageclass_sfx', '');
     if (!isset($my->id)) {
         //for 1.6
         $my->id = 0;
     }
     if ($GLOBALS['lendstatus_show']) {
         $params->def('show_lendstatus', 1);
         if (checkAccessBL($GLOBALS['lendrequest_registrationlevel'], 'RECURSE', userGID_BL($my->id), $acl)) {
             $params->def('show_lendrequest', 1);
         }
     }
     if ($GLOBALS['reviews_show']) {
         $params->def('show_reviews', 1);
         if (checkAccessBL($GLOBALS['reviews_registrationlevel'], 'RECURSE', userGID_BL($my->id), $acl)) {
             $params->def('show_inputreviews', 1);
         }
     }
     if ($GLOBALS['ebooks_show']) {
         $params->def('show_ebookstatus', 1);
         if (checkAccessBL($GLOBALS['ebooks_registrationlevel'], 'RECURSE', userGID_BL($my->id), $acl)) {
             $params->def('show_ebooksrequest', 1);
         }
     }
     if ($GLOBALS['price_show']) {
         $params->def('show_pricestatus', 1);
         if (checkAccessBL($GLOBALS['price_registrationlevel'], 'RECURSE', userGID_BL($my->id), $acl)) {
             $params->def('show_pricerequest', 1);
         }
     }
     //------------------------------------- begin add for  Manager : buttons    ******************************
     if ($GLOBALS['print_pdf_show']) {
         $params->def('show_print_pdf', 1);
         if (checkAccessBL($GLOBALS['print_pdf_registrationlevel'], 'RECURSE', userGID_BL($my->id), $acl)) {
             $params->def('show_input_print_pdf', 1);
         }
     }
     if ($GLOBALS['print_view_show']) {
         $params->def('show_print_view', 1);
         if (checkAccessBL($GLOBALS['print_view_registrationlevel'], 'RECURSE', userGID_BL($my->id), $acl)) {
             $params->def('show_input_print_view', 1);
         }
     }
     if ($GLOBALS['mail_to_show']) {
         $params->def('show_mail_to', 1);
         if (checkAccessBL($GLOBALS['mail_to_registrationlevel'], 'RECURSE', userGID_BL($my->id), $acl)) {
             $params->def('show_input_mail_to', 1);
         }
     }
     //------------------------------------------   end add for  Manager : buttons     ******************************
     //************   begin add button 'buy now'   ***************************
     if ($GLOBALS['buy_now_show']) {
         $params->def('show_buy_now', 1);
         $s = explode(',', $GLOBALS['buy_now_allow_categories']);
         foreach ($s as $i) {
             if ($i == $catid || $i == -2) {
                 $params->def('show_input_buy_now', 1);
                 break;
             }
         }
     }
     //************   end add button 'buy now'   ********************************
     //************   begin add button 'buy now vm'   ***************************
     //************   end add button 'buy now vm'   ********************************
     $params->def('pageclass_sfx', '');
     $params->def('item_description', 1);
     $params->def('lend_request', $GLOBALS['lendrequest_registrationlevel']);
     $params->def('show_ebook', $GLOBALS['ebooks_show']);
     $params->def('show_price', $GLOBALS['price_show']);
     $params->def('back_button', $mainframe->getCfg('back_button'));
     // page header
     $currentcat = new stdClass();
     $currentcat->header = '';
     if (@$currentcat->name != '') {
         $currentcat->header = $currentcat->name;
     } else {
         $currentcat->header = $params->get('header');
     }
     $currentcat->header = $currentcat->header . ($currentcat->header != '' ? ": " : '') . $book->title;
     //get language List
     $retVal1 = mosBooklibraryOthers::getLanguageArray();
     $book_lang = null;
     for ($i = 0, $n = count($retVal1); $i < $n; $i++) {
         $help = $retVal1[$i];
         if ($book->language == $help[0]) {
             $book_lang = $help[1];
             break;
         }
     }
     if ($book->rating == 0) {
         $database->setQuery("SELECT ROUND(avg(rating) ) FROM #__booklibrary_review WHERE fk_bookid = " . $book->id . " group by  fk_bookid  ");
         $book->rating = $database->loadResult();
         if ($book->rating == null) {
             $book->rating = 0;
         }
     }
     $database->setQuery("SELECT username FROM #__users WHERE email='{$book->owneremail}'");
     $book->ownername = $database->loadResult();
     // show the book
     // for 1.6
     // get a category list which the book is connected to
     $s = getWhereUsergroupsString("mc");
     // get user acces level
     $query_c = "SELECT * FROM #__booklibrary_categories AS bc\n                LEFT JOIN  #__booklibrary_main_categories  AS mc\n                ON bc.catid=mc.id AND ({$s})\n                WHERE bc.bookid=" . $book->id;
     $database->setQuery($query_c);
     $categories = $database->loadObjectList();
     // --
     //----------------------------------------------------------------
     $params->def('view01', "{loadposition com_booklibrary_view_book_01}");
     $params->def('view02', "{loadposition com_booklibrary_view_book_02}");
     $params->def('view03', "{loadposition com_booklibrary_view_book_03}");
     $params->def('viewdescription', "{loadposition com_booklibrary_view_book_description}");
     $params->def('view04', "{loadposition com_booklibrary_view_book_04}");
     $params->def('view05', "{loadposition com_booklibrary_view_book_05}");
     $params->def('view06', "{loadposition com_booklibrary_view_book_06}");
     $params->def('view07', "{loadposition com_booklibrary_view_book_07}");
     //   if ($layout == ''){
     //       $params2 = unserialize($category->params2);
     //       $layout = $params2->view_book;
     //   }
     //   if ($layout == '')
     //       $layout = 'default';
     //   $params2 = unserialize($category->params2);
     //
     //   if($layout == null)
     //   {
     //     $layout = "default";
     //   }
     //   else
     //   {
     //     if($params2 == null)
     //     {
     //       $layout = "default";
     //     }
     //     else
     //     {
     //       $layout = $params2->view_book;
     //     }
     //   }
     $query = "SELECT * FROM #__booklibrary_main_categories WHERE id=" . $catid;
     $database->setQuery($query);
     $catid = $database->loadObjectList();
     //print_r($catid);exit;
     $params2 = unserialize($catid[0]->params2);
     //print_r($params2);exit;
     if (!$params2 == null) {
         //print_r($catid);
         //print_r($a);
         $layout = $params2->view_book;
         //print_r($layout);
         //exit;
     } else {
         $layout = "default";
     }
     //--------------------
     //get owner
     if ($book->owner_id != 0 && $booklibrary_configuration['owner']['show'] != '0') {
         $query = "SELECT name, email FROM #__users WHERE id = " . $book->owner_id . "";
         $database->setQuery($query);
         $user_b = $database->loadObject();
         $book->user_b = $user_b;
     }
     //--------------------
     //ebook urls
     $query = "select * " . " from  #__booklibrary_files AS s " . " where s.fk_book_id=" . $book->id . " ORDER BY s.id ";
     $database->setQuery($query);
     $row = $database->loadObjectList();
     //print_r($row);exit;
     $book->ebookURL = $row;
     switch ($printItem) {
         default:
             HTML_booklibrary::displayBook($book, $tabclass, $params, $currentcat, $categories, $ratinglist, $book_lang, $id, $catid, $layout);
             break;
     }
     //----------------------------------------------------------------------
 }