2)
{
if (isset($_POST['entryAdd']))
{
if (blog::add($_POST['entryHeader'], $_POST['entryTitle'], $_POST['entrySlug'], $_POST['entryContent'], $_POST['entryPublished'], (isset($_POST['entryHidden']) ? true : false), $_POST['entryPIN']))
redirect(get_entry_link($_POST['entrySlug']), 'added');
else
array_push($error, $_locale['entry_not_added']);
} elseif (isset($_POST['entryUpdate']))
{
if (blog::update($_POST['entryUpdate'], $_POST['entryHeader'], $_POST['entryTitle'], $_POST['entryContent'], $_POST['entryPublished'], (isset($_POST['entryHidden']) ? true : false), $_POST['entryPIN']))
redirect(get_current_link(), 'updated');
else
array_push($error, $_locale['entry_not_updated']);
}
}
if (isset($_POST['entryTag']) && $user['userLevel'] > 2)
{
if (isset($_POST['tagIdRemove']))
{
if (blog::tagRemove($_POST['tagIdRemove'], $_POST['entryId']))
array_push($info, $_locale['entry_tag_removed']);
else
array_push($error, $_locale['entry_tag_not_removed']);
} elseif (blog::tag($_POST['tagId'], $_POST['entryId']))
array_push($info, $_locale['entry_tag_added']);
else
array_push($error, $_locale['entry_tag_not_added']);
}
if (isset($seo[2]) && $user['userLevel'] > 2)
{
$entry = new blog($seo[2]);
if ($entry->entries)
{
$entryData = $entry->entry();
if (isset($seo[3]) && $user['userLevel'] > 3)
switch ($seo[3])
{
case 'delete':
if ($entry->delete($entryData['entryId']))
redirect('/admin/entry');
else
array_push($error, $_locale['entry_not_deleted']);
break;
case 'pin':
if ($entry->pin($entryData['entryId']))
redirect();
else
array_push($error, $_locale['entry_not_pinned']);
break;
case 'unpin':
if ($entry->unpin($entryData['entryId']))
redirect();
else
array_push($error, $_locale['entry_not_unpinned']);
break;
}
}
} else
{
$timedQuery = $_sql->query("SELECT entrySlug, entryTitle, entryCreated, entryPublished FROM entries WHERE entryPublished > ".time()."");
if ($timedQuery->num_rows)
{
echo "
{locale:timed_entries} ";
echo "{locale:entry_title} {locale:created_on} {locale:timed_pub_date} ";
while ($data = $timedQuery->fetch_assoc())
echo "$data[entryTitle] ".show_date($data['entryCreated'])." ".show_date($data['entryPublished'])." ";
echo "
";
}
$hiddenQuery = $_sql->query("SELECT entrySlug, entryTitle, entryCreated, entryPublished FROM entries WHERE entryHidden IS NOT NULL");
if ($hiddenQuery->num_rows)
{
echo "{locale:hidden_entries} ";
echo "{locale:entry_title} {locale:created_on} {locale:timed_pub_date} ";
while ($data = $hiddenQuery->fetch_assoc())
echo "$data[entryTitle] ".show_date($data['entryCreated'])." ".show_date($data['entryPublished'])." ";
echo "
";
}
}
?>
{locale:entry_editor}
query("SELECT * FROM tags");
if ($tags->num_rows)
{
echo "{locale:tags} ";
echo "{locale:tag_name} {locale:add} "
.""
." "
." ";
while ($tag = $tags->fetch_assoc())
echo "$tag[tagName] ".($_sql->query("SELECT taggedId FROM tagged WHERE taggedEntry = $entryData[entryId] AND taggedTag = $tag[tagId]")->num_rows ? "{locale:remove} ":"{locale:add} ")." ";
echo " "
."
";
}
}
?>