Esempio n. 1
0
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "UPDATE " . $db->prefix("mod_mywords_posts") . " SET status='{$status}' WHERE id_post IN (" . implode(",", $posts) . ")";
    if (!$db->queryF($sql)) {
        redirectMsg('posts.php?' . $q, __('Posts could not be updated!', 'mw_categories'), 1);
        die;
    }
    redirectMsg('posts.php?' . $q, __('Posts updated successfully!', 'mywords'), 0);
}
$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
switch ($op) {
    case 'new':
        newForm();
        break;
    case 'edit':
        newForm(1);
        break;
    case 'saveretedit':
        saveEdited(0);
        break;
    case 'saveedit':
    case 'publishedit':
        saveEdited(1);
        break;
    case 'delete':
        deletePost();
        break;
    case 'trackbacks':
        include 'trackbacks.php';
        break;
    case 'waiting':
Esempio n. 2
0
function getBot()
{
    #die('entered function.');
    global $dbn;
    $dbconn = db_open();
    $formCell = '                <td><label for="[row_label]"><span class="label">[row_label]:</span></label> <span class="formw"><input name="[row_label]" id="[row_label]" value="[row_value]" /></span></td>
';
    $blankCell = '                <td style="text-align: center"><label for="newEntryName[cid]"><span class="label">New Entry Name: <input name="newEntryName[cid]" id="newEntryName[cid]" style="width: 98%" /></label></span>&nbsp;<span class="formw"><label for="newEntryValue[cid]" style="float: left; padding-left: 3px;">New Entry Value: </label><input name="newEntryValue[cid]" id="newEntryValue[cid]" /></span></td>
';
    $startDiv = '      <td>' . "\n        ";
    $endDiv = "\n      </td>\n      <br />\n";
    $inputs = "";
    $row_class = 'row fm-opt';
    $bot_name = $_SESSION['poadmin']['bot_name'];
    $bot_id = isset($_SESSION['poadmin']['bot_id']) ? $_SESSION['poadmin']['bot_id'] : 0;
    //get the current bot's personality table from the db
    $sql = "SELECT * FROM `botpersonality` where  bot = {$bot_id}";
    #die ("SQL = $sql<br />db name = $dbn\n");
    $result = mysql_query($sql, $dbconn) or $msg .= SQL_Error(mysql_errno());
    if ($result) {
        $rowCount = mysql_num_rows($result);
        if ($rowCount > 0) {
            $left = true;
            $colCount = 0;
            while ($row = mysql_fetch_assoc($result)) {
                $rid = $row['id'];
                $label = $row['name'];
                $value = stripslashes_deep($row['value']);
                $tmpRow = str_replace('[row_class]', $row_class, $formCell);
                $tmpRow = str_replace('[row_id]', $rid, $tmpRow);
                $tmpRow = str_replace('[row_label]', $label, $tmpRow);
                $tmpRow = str_replace('[row_value]', $value, $tmpRow);
                $inputs .= $tmpRow;
                $colCount++;
                if ($colCount >= 3) {
                    $inputs .= '              </tr>
              <tr>';
                    $colCount = 0;
                }
            }
            $inputs .= "<!-- colCount = {$colCount} -->\n";
            if ($colCount > 0 and $colCount < 3) {
                for ($n = 0; $n < 3 - $colCount; $n++) {
                    $addCell = str_replace('[cid]', "[{$n}]", $blankCell);
                    $inputs .= $addCell;
                }
            }
            mysql_close($dbconn);
            $action = 'Update Data';
            $func = 'updateBot';
        } else {
            $inputs = newForm();
            $action = 'Add New Data';
            $func = 'addBotPersonality';
        }
    }
    if (empty($func)) {
        $func = 'getBot';
    }
    $form = <<<endForm2
          <form name="botpersonality" action="./?page=botpersonality" method="post">
            <table class="botForm">
              <tr>
{$inputs}
              </tr>
              <tr>
                <td colspan="3">
                  <input type="hidden" id="bot_id" name="bot_id" value="{$bot_id}">
                  <input type="hidden" id="func" name="func" value="{$func}">
                  <input type="submit" name="action" id="action" value="{$action}">
                </td>
              </tr>
            </table>
          </form>
  <!-- fieldset>
  </fieldset -->
endForm2;
    return $form;
}
Esempio n. 3
0
/**
 * Function getBot
 *
 *
 * @return string
 */
function getBot()
{
    global $dbn, $dbConn;
    $formCell = '                <td>
                   <label for="[row_label]">
                     <span class="label">[row_label]:</span>
                     <span class="formw">
                       <input name="[row_label]" id="[row_label]" value="[row_value]" />
                     </span>
                   </label>
                 </td>
';
    $blankCell = '                <td style="text-align: center">
                   <label for="newEntryName[cid]">
                     <span class="label">
                       New Entry Name: <input name="newEntryName[cid]" id="newEntryName[cid]" style="width: 98%" />
                     </span>
                   </label>&nbsp;
                   <label for="newEntryValue[cid]" style="float: left; padding-left: 3px;">
                     <span class="formw">New Entry Value: </span>
                     <input name="newEntryValue[cid]" id="newEntryValue[cid]" />
                   </label>
                 </td>
';
    $startDiv = '      <td>' . "\n        ";
    $endDiv = "\n      </td>\n      <br />\n";
    $inputs = "";
    $row_class = 'row fm-opt';
    $bot_name = $_SESSION['poadmin']['bot_name'];
    $bot_id = isset($_SESSION['poadmin']['bot_id']) ? $_SESSION['poadmin']['bot_id'] : 0;
    $bot_id = $bot_id == 'new' ? 0 : $bot_id;
    //get the current bot's personality table from the db
    $sql = "SELECT * FROM `botpersonality` where  `bot_id` = {$bot_id}";
    $sth = $dbConn->prepare($sql);
    $sth->execute();
    $rows = $sth->fetchAll(PDO::FETCH_ASSOC);
    $rowCount = count($rows);
    if ($rowCount > 0) {
        $left = true;
        $colCount = 0;
        foreach ($rows as $row) {
            $rid = $row['id'];
            $label = $row['name'];
            $value = stripslashes_deep($row['value']);
            $tmpRow = str_replace('[row_class]', $row_class, $formCell);
            $tmpRow = str_replace('[row_id]', $rid, $tmpRow);
            $tmpRow = str_replace('[row_label]', $label, $tmpRow);
            $tmpRow = str_replace('[row_value]', $value, $tmpRow);
            $inputs .= $tmpRow;
            $colCount++;
            if ($colCount >= 3) {
                $inputs .= '              </tr>
              <tr>' . PHP_EOL;
                $colCount = 0;
            }
        }
        $inputs .= "<!-- colCount = {$colCount} -->\n";
        if ($colCount > 0 and $colCount < 3) {
            for ($n = 0; $n < 3 - $colCount; $n++) {
                $addCell = str_replace('[cid]', "[{$n}]", $blankCell);
                $inputs .= $addCell;
            }
        }
        $action = 'Update Data';
        $func = 'updateBot';
    } else {
        $inputs = newForm();
        $action = 'Add New Data';
        $func = 'addBotPersonality';
    }
    if (empty($func)) {
        $func = 'getBot';
    }
    $form = <<<endForm2
          <form name="botpersonality" action="index.php?page=botpersonality" method="post">
            <table class="botForm">
              <tr>
{$inputs}
              </tr>
              <tr>
                <td colspan="3">
                  <input type="hidden" id="bot_id" name="bot_id" value="{$bot_id}">
                  <input type="hidden" id="func" name="func" value="{$func}">
                  <input type="submit" name="action" id="action" value="{$action}">
                </td>
              </tr>
            </table>
          </form>
  <!-- fieldset>
  </fieldset -->
endForm2;
    return $form;
}
Esempio n. 4
0
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("mw_categories") . " WHERE id_cat IN (" . implode(",", $cats) . ")";
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $cat = new MWCategory();
        $cat->assignVars($row);
        if (!$cat->delete()) {
            showMessage(__('Category "%s" could not be deleted', 'mywords'), 1);
        }
    }
    redirectMsg('categories.php', __('Database updated!', 'mw_categories'), 0);
}
$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
switch ($op) {
    case 'save':
        saveCatego();
        break;
    case 'saveedit':
        saveCatego(1);
        break;
    case 'edit':
        newForm();
        break;
    case 'delete':
        deleteCatego();
        break;
    default:
        showCategos();
        break;
}