Пример #1
0
function grepDd($html, $parent_cid)
{
    $pattern = '/<dd[\\s\\S]*?categoryId="(\\d+)"[\\s\\S]*?href="(.*?)".*?>(.*?)<\\/a>[\\s\\S]*?<\\/dd>/';
    if (preg_match_all($pattern, $html, $reg)) {
        foreach ($reg[0] as $id => $dd) {
            $cid = $reg[1][$id];
            saveCategory($cid, $reg[3][$id], $parent_cid, 0, $reg[2][$id]);
        }
    }
}
Пример #2
0
 /**
  * Save new categories based on the received array.
  * Takes a json encoded category.
  * Will append a json array of key pairs ["provided id":"saved category id", ] to the $output_array
  * @param array $category the json to array category
  * @param int $parent_id the parent ID of the category to save (the one in OUR database, not Kem's central one)
  */
 function saveCategory($category, $parent_id)
 {
     $cat = new Category();
     $cat->parent_category = $parent_id;
     $cat->visible = $category->visible;
     $cat->is_brand = $category->is_brand;
     $cat->save();
     foreach ($category->localizations as $localization) {
         $loc = new CategoryLocalization();
         $loc->locale_id = Locale::localeIdFromLongCode($localization->locale);
         $loc->category_id = $cat->id;
         $loc->name = $localization->name;
         $loc->visible = $localization->visible;
         $loc->save();
     }
     $GLOBALS['output_array'][$category->id] = $cat->id;
     // Think of the the children
     foreach ($category->children as $child) {
         saveCategory($child, $cat->id);
     }
 }
Пример #3
0
function dbUtil($type, $paramList = null)
{
    global $retArray;
    try {
        $mongo = new MongoClient('mongodb://nb403:27127/admin:admin');
        $db = $mongo->adtestClassicBugs;
        if ($type == SaveCategory) {
            saveCategory($db, $paramList);
        } elseif ($type == ReadCategory) {
            return readCateList($db);
        } elseif ($type == SaveInputContent) {
            saveInputContent($db, $paramList);
        } elseif ($type == ReadAllContents) {
            return listContent($db);
        } elseif ($type == ReadSpecificContent) {
            return listContent2($db, $paramList);
        } elseif ($type == UpdateSpecificContent) {
            updateInfo($db, $paramList);
        }
    } catch (MongoConnectionException $e) {
        $retArray = array("1", $e->getMessage());
    }
}
        showSMSDetails($option);
        break;
    case "editsubscribers":
        showCategory($option);
        break;
    case "showsubscribers":
        showSubscribers($option);
        break;
    case "showmaintenance":
        showMaintenance($option);
        break;
    case "showbackup":
        showBackup($option);
        break;
    case "savecategory":
        saveCategory($option);
        break;
    case "savemailformat":
        saveMailFormat($option);
        break;
    case "savesmsdetails":
        saveSMSDetails($option);
        break;
    case "configuration":
        showNewsMailer($option);
        break;
    default:
        showCPanel($option);
        break;
}
function bulkAddUsers($option)
Пример #5
0
     moveCategorySelect($option, $cid, $section);
     break;
 case 'movesave':
     moveCategorySave($cid, $section);
     break;
 case 'copyselect':
     copyCategorySelect($option, $cid, $section);
     break;
 case 'copysave':
     copyCategorySave($cid, $section);
     break;
 case 'go2menu':
 case 'go2menuitem':
 case 'save':
 case 'apply':
     saveCategory();
     break;
 case 'remove':
     removeCategories($section, $cid);
     break;
 case 'publish':
     publishCategories($section, $cid, 1);
     break;
 case 'unpublish':
     publishCategories($section, $cid, 0);
     break;
 case 'cancel':
     cancelCategory();
     break;
 case 'orderup':
     orderCategory($cid[0], -1);
Пример #6
0
        die;
    }
}
$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
switch ($op) {
    case 'new':
        formCategory();
        break;
    case 'edit':
        formCategory(1);
        break;
    case 'save':
        saveCategory();
        break;
    case 'saveedit':
        saveCategory(1);
        break;
    case 'delete':
        deleteCategory();
        break;
    case 'update':
        updateCategory();
        break;
    case 'active':
        activeCategory(1);
        break;
    case 'desactive':
        activeCategory();
        break;
    default:
        showCategories();
Пример #7
0
function analyzeItem($html, $yhd_cid)
{
    $pattern = '/<img width="200" height="200".*?"(http:\\/\\/.*?)".*?alt="(.*?)"\\/>/';
    if (preg_match($pattern, $html, $reg)) {
        $imgSrc = $reg[1];
        $title = $reg[2];
    }
    $pattern = '/<a class="search_prod_img".*?pmId="(\\d+)".*?href="(.*?)" /';
    if (preg_match($pattern, $html, $reg)) {
        $yhdNumIID = $reg[1];
        $link = $reg[2];
    }
    saveItem($yhdNumIID, $title, $imgSrc, $link);
    saveCategory($yhdNumIID, $yhd_cid);
}
Пример #8
0
     break;
 case 'movesave':
     moveCategorySave($cid, $section);
     break;
 case 'copyselect':
     copyCategorySelect($option, $cid, $section);
     break;
 case 'copysave':
     copyCategorySave($cid, $section);
     break;
 case 'go2menu':
 case 'go2menuitem':
 case 'menulink':
 case 'save':
 case 'apply':
     saveCategory($task);
     break;
 case 'remove':
     removeCategories($section, $cid);
     break;
 case 'publish':
     publishCategories($section, $id, $cid, 1);
     break;
 case 'unpublish':
     publishCategories($section, $id, $cid, 0);
     break;
 case 'cancel':
     cancelCategory();
     break;
 case 'orderup':
     orderCategory(intval($cid[0]), -1);
function showArticleAdministration()
{
    require_once ROOT . "includes/items.php";
    require_once ROOT . "DBInterface/articleDB.php";
    require_once ROOT . "DBInterface/languageDB.php";
    require_once ROOT . "DBInterface/articleTranslationDB.php";
    if (isset($_POST['action'])) {
        if ($_POST['action'] == 'add') {
            $articleDB = new ArticleDB();
            $res = $articleDB->addArticle($_POST['artSystemName'], $_POST['artSystemDescription'], $_POST['artPrice'], $_POST['artImagePath']);
            $resID = $res->fetch_object();
            $artID = $resID->Article_ID;
            saveCategory($artID);
            saveLanguages($artID);
        } else {
            if ($_POST['action'] == 'update') {
                $articleDB = new ArticleDB();
                $artID = $_POST['artId'];
                $res = $articleDB->updateArticle($_POST['artId'], $_POST['artSystemName'], $_POST['artSystemDescription'], $_POST['artPrice'], $_POST['artImagePath']);
                saveCategory($artID);
                saveLanguages($artID);
            } else {
                if ($_POST['action'] == 'delete') {
                    $artID = $_POST['artId'];
                    deleteArticle($artID);
                }
            }
        }
    }
    $lang = $_COOKIE["lang"];
    include ROOT . "resources/{$lang}.php";
    $items = array();
    $article = null;
    $articleDB = new ArticleDB();
    echo "<table  class=\"basket-table\" border=\"1px\">";
    echo "<thead>";
    echo "<tr>";
    echo "<th>{$adminArticleId}</th>";
    echo "<th>{$adminArticleName}</th>";
    echo "<th>{$adminArticleDescription}</th>";
    echo "<th>{$adminArticlePrice}</th>";
    echo "<th>{$adminArticleImage}</th>";
    echo "<th>&nbsp;</th>";
    echo "<th>&nbsp;</th>";
    echo "</tr>";
    echo "</thead>";
    echo "<tbody>";
    $res = $articleDB->getAllArticles();
    while ($items = $res->fetch_object()) {
        $articleId = $items->Article_ID;
        $articleName = $items->ArticleName;
        $articleDescription = $items->ArticleDescription;
        $articlePrice = $items->ArticlePrice;
        $articleImage = $items->ArticleImage;
        $article = new article($articleId, $articleName, $articlePrice, $articleDescription, $articleImage, null);
        echo "<tr>";
        echo "<td>" . $article->getId() . "</td>";
        echo "<td>" . $article->getName() . "</td>";
        echo "<td>" . $article->getDescription() . "</td>";
        echo "<td>" . $article->getPrice() . "</td>";
        echo "<td>" . $article->getImage() . "</td>";
        echo "<form action=\"index.php?site=changeArticle\" method=\"get\">";
        echo "<input type=\"hidden\" name=\"artId\" value=\"" . $article->getId() . "\" /input>";
        echo "<input type=\"hidden\" name=\"site\" value=\"changeArticle\" /input>";
        echo "<input type=\"hidden\" name=\"origin\" value=\"update\" /input>";
        echo "<td> <input class=\"basket-update-button\" type=\"submit\" value=\"{$adminArticleUpdateLabel}\"/></td>";
        echo "</form>";
        echo "<form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "\" method=\"post\">";
        echo "<input type=\"hidden\" name=\"artId\" value=\"" . $article->getId() . "\" /input>";
        echo "<input type=\"hidden\" name=\"action\" value=\"delete\" /input>";
        echo "<td> <input class=\"basket-delete-button\" name=\"delete\" type=\"submit\" value=\"{$adminArticleDeleteLabel}\"/></td>";
        echo "</form>";
        echo "</tr>";
        echo "</form>";
    }
    // last line to add a new article
    echo "<form action=\"index.php?site=changeArticle\" method=\"get\">";
    // echo "<input type=\"hidden\" name=\"articleId\" value=\"" . $articleId . "\" /input>";
    echo "<tr>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<td></td>";
    echo "<input type=\"hidden\" name=\"site\" value=\"changeArticle\" /input>";
    echo "<input type=\"hidden\" name=\"origin\" value=\"add\" /input>";
    echo "<td> <input class=\"basket-update-button\"  type=\"submit\" value=\"{$adminArticleAddLabel}\"/></td>";
    echo "</tr>";
    echo "</form>";
    echo "</tbody>";
    echo "</table>";
}